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

Unified Diff: src/core/SkSpriteBlitter_ARGB32.cpp

Issue 1144923005: use SkPixmap inside sprite blitters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkSpriteBlitter.h ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSpriteBlitter_ARGB32.cpp
diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp
index c3f63fee9afb21f36165fd44bb510e5e017a0311..7d5ac152db325c3ba42dbb6f5b7a48ffb5c5e9e0 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -37,8 +37,7 @@ public:
void blitRect(int x, int y, int width, int height) override {
SkASSERT(width > 0 && height > 0);
uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y);
- const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
- y - fTop);
+ const uint32_t* SK_RESTRICT src = fSource->addr32(x - fLeft, y - fTop);
size_t dstRB = fDevice->rowBytes();
size_t srcRB = fSource->rowBytes();
SkBlitRow::Proc32 proc = fProc32;
@@ -91,9 +90,10 @@ public:
SkSafeUnref(fColorFilter);
}
- virtual void setup(const SkBitmap& device, int left, int top,
- const SkPaint& paint) override {
- this->INHERITED::setup(device, left, top, paint);
+ bool setup(const SkBitmap& device, int left, int top, const SkPaint& paint) override {
+ if (!this->INHERITED::setup(device, left, top, paint)) {
+ return false;
+ }
int width = device.width();
if (width > fBufferSize) {
@@ -101,6 +101,7 @@ public:
delete[] fBuffer;
fBuffer = new SkPMColor[width];
}
+ return true;
}
protected:
@@ -125,8 +126,7 @@ public:
void blitRect(int x, int y, int width, int height) override {
SkASSERT(width > 0 && height > 0);
uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y);
- const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
- y - fTop);
+ const uint32_t* SK_RESTRICT src = fSource->addr32(x - fLeft, y - fTop);
size_t dstRB = fDevice->rowBytes();
size_t srcRB = fSource->rowBytes();
SkColorFilter* colorFilter = fColorFilter;
@@ -172,8 +172,7 @@ public:
void blitRect(int x, int y, int width, int height) override {
SkASSERT(width > 0 && height > 0);
SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
- const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
- y - fTop);
+ const SkPMColor16* SK_RESTRICT src = fSource->addr16(x - fLeft, y - fTop);
size_t dstRB = fDevice->rowBytes();
size_t srcRB = fSource->rowBytes();
SkPMColor* SK_RESTRICT buffer = fBuffer;
@@ -219,8 +218,7 @@ public:
void blitRect(int x, int y, int width, int height) override {
SkASSERT(width > 0 && height > 0);
SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
- const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
- y - fTop);
+ const SkPMColor16* SK_RESTRICT src = fSource->addr16(x - fLeft, y - fTop);
size_t dstRB = fDevice->rowBytes();
size_t srcRB = fSource->rowBytes();
@@ -248,8 +246,7 @@ public:
void blitRect(int x, int y, int width, int height) override {
SkASSERT(width > 0 && height > 0);
SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
- const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
- y - fTop);
+ const SkPMColor16* SK_RESTRICT src = fSource->addr16(x - fLeft, y - fTop);
size_t dstRB = fDevice->rowBytes();
size_t srcRB = fSource->rowBytes();
« no previous file with comments | « src/core/SkSpriteBlitter.h ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698