aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-04-11 11:13:41 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-11 15:46:37 +0000
commit2b67005be0a4b0f043b9f08784ccba813668599e (patch)
treeddc547631637d0e47c27da9adb687cb8b9c83493 /src
parent73297197b2a27e288d7b9a4d8ff67f6ce5e25b10 (diff)
no need to tile draws that don't involve paths
Bug: skia: Change-Id: I2e974162982a81b1d2ac2505df809f15354ded07 Reviewed-on: https://skia-review.googlesource.com/120425 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmapDevice.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 5f84ba1aec..f3299ad28c 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -130,6 +130,19 @@ private:
#define TILER_X(x) (x) - priv_tiler.curr_x()
#define TILER_Y(y) (y) - priv_tiler.curr_y()
+// Helper to create an SkDraw from a device
+class SkBitmapDevice::BDDraw : public SkDraw {
+public:
+ BDDraw(SkBitmapDevice* dev) {
+ // we need fDst to be set, and if we're actually drawing, to dirty the genID
+ if (!dev->accessPixels(&fDst)) {
+ // NoDrawDevice uses us (why?) so we have to catch this case w/ no pixels
+ fDst.reset(dev->imageInfo(), nullptr, 0);
+ }
+ fMatrix = &dev->ctm();
+ fRC = &dev->fRCStack.rc();
+ }
+};
class SkColorTable;
@@ -282,7 +295,7 @@ bool SkBitmapDevice::onReadPixels(const SkPixmap& pm, int x, int y) {
///////////////////////////////////////////////////////////////////////////////
void SkBitmapDevice::drawPaint(const SkPaint& paint) {
- LOOP_TILER( drawPaint(paint))
+ BDDraw(this).drawPaint(paint);
}
void SkBitmapDevice::drawPoints(SkCanvas::PointMode mode, size_t count,
@@ -460,7 +473,7 @@ void SkBitmapDevice::drawBitmapRect(const SkBitmap& bitmap,
}
void SkBitmapDevice::drawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint& paint) {
- LOOP_TILER( drawSprite(bitmap, TILER_X(x), TILER_Y(y), paint))
+ BDDraw(this).drawSprite(bitmap, x, y, paint);
}
void SkBitmapDevice::drawText(const void* text, size_t len,
@@ -476,9 +489,9 @@ void SkBitmapDevice::drawPosText(const void* text, size_t len, const SkScalar xp
void SkBitmapDevice::drawVertices(const SkVertices* vertices, SkBlendMode bmode,
const SkPaint& paint) {
- LOOP_TILER( drawVertices(vertices->mode(), vertices->vertexCount(), vertices->positions(),
- vertices->texCoords(), vertices->colors(), bmode,
- vertices->indices(), vertices->indexCount(), paint))
+ BDDraw(this).drawVertices(vertices->mode(), vertices->vertexCount(), vertices->positions(),
+ vertices->texCoords(), vertices->colors(), bmode,
+ vertices->indices(), vertices->indexCount(), paint);
}
void SkBitmapDevice::drawDevice(SkBaseDevice* device, int x, int y, const SkPaint& origPaint) {