Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 23641008: Baby step in making SkGpuDevice no longer derive from SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: cleaned up Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrTextureDomainEffect.h" 10 #include "effects/GrTextureDomainEffect.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 copy.setColor(SkColorSetA(color, newA)); 562 copy.setColor(SkColorSetA(color, newA));
563 return skPaint2GrPaintNoShader(dev, copy, false, constantColor, grPa int); 563 return skPaint2GrPaintNoShader(dev, copy, false, constantColor, grPa int);
564 } else { 564 } else {
565 return false; 565 return false;
566 } 566 }
567 } 567 }
568 } 568 }
569 } 569 }
570 570
571 /////////////////////////////////////////////////////////////////////////////// 571 ///////////////////////////////////////////////////////////////////////////////
572 void SkGpuDevice::getGlobalBounds(SkIRect* bounds) const {
573 if (NULL != bounds) {
574 const SkIPoint& origin = this->getOrigin();
575 bounds->setXYWH(origin.x(), origin.y(),
576 this->width(), this->height());
577 }
578 }
579
580 SkBitmap::Config SkGpuDevice::config() const {
581 if (NULL == fRenderTarget) {
582 return SkBitmap::kNo_Config;
583 }
584
585 bool isOpaque;
586 return grConfig2skConfig(fRenderTarget->config(), &isOpaque);
587 }
588
572 void SkGpuDevice::clear(SkColor color) { 589 void SkGpuDevice::clear(SkColor color) {
573 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); 590 SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
574 fContext->clear(&rect, SkColor2GrColor(color), fRenderTarget); 591 fContext->clear(&rect, SkColor2GrColor(color), fRenderTarget);
575 fNeedClear = false; 592 fNeedClear = false;
576 } 593 }
577 594
578 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 595 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
579 CHECK_SHOULD_DRAW(draw, false); 596 CHECK_SHOULD_DRAW(draw, false);
580 597
581 GrPaint grPaint; 598 GrPaint grPaint;
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 // clear of the source device must occur before CHECK_SHOULD_DRAW 1564 // clear of the source device must occur before CHECK_SHOULD_DRAW
1548 SkGpuDevice* dev = static_cast<SkGpuDevice*>(device); 1565 SkGpuDevice* dev = static_cast<SkGpuDevice*>(device);
1549 if (dev->fNeedClear) { 1566 if (dev->fNeedClear) {
1550 // TODO: could check here whether we really need to draw at all 1567 // TODO: could check here whether we really need to draw at all
1551 dev->clear(0x0); 1568 dev->clear(0x0);
1552 } 1569 }
1553 1570
1554 // drawDevice is defined to be in device coords. 1571 // drawDevice is defined to be in device coords.
1555 CHECK_SHOULD_DRAW(draw, true); 1572 CHECK_SHOULD_DRAW(draw, true);
1556 1573
1557 GrRenderTarget* devRT = device->accessRenderTarget(); 1574 GrRenderTarget* devRT = dev->accessRenderTarget();
1558 GrTexture* devTex; 1575 GrTexture* devTex;
1559 if (NULL == (devTex = devRT->asTexture())) { 1576 if (NULL == (devTex = devRT->asTexture())) {
1560 return; 1577 return;
1561 } 1578 }
1562 1579
1563 const SkBitmap& bm = dev->accessBitmap(false); 1580 const SkBitmap& bm = dev->accessBitmap(false);
1564 int w = bm.width(); 1581 int w = bm.width();
1565 int h = bm.height(); 1582 int h = bm.height();
1566 1583
1567 SkImageFilter* filter = paint.getImageFilter(); 1584 SkImageFilter* filter = paint.getImageFilter();
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 GrTexture* texture, 1881 GrTexture* texture,
1865 bool needClear) 1882 bool needClear)
1866 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1883 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1867 1884
1868 SkASSERT(texture && texture->asRenderTarget()); 1885 SkASSERT(texture && texture->asRenderTarget());
1869 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1886 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1870 // cache. We pass true for the third argument so that it will get unlocked. 1887 // cache. We pass true for the third argument so that it will get unlocked.
1871 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1888 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1872 fNeedClear = needClear; 1889 fNeedClear = needClear;
1873 } 1890 }
OLDNEW
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698