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

Unified Diff: src/core/SkSpriteBlitter_ARGB32.cpp

Issue 1156713004: remove bitmaps entirely from sprite blits (as source) (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/SkSpriteBlitterTemplate.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 7d5ac152db325c3ba42dbb6f5b7a48ffb5c5e9e0..4138b72902d2632a96604d0c37df473c9721d252 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -19,7 +19,7 @@
class Sprite_D32_S32 : public SkSpriteBlitter {
public:
- Sprite_D32_S32(const SkBitmap& src, U8CPU alpha) : INHERITED(src) {
+ Sprite_D32_S32(const SkPixmap& src, U8CPU alpha) : INHERITED(src) {
SkASSERT(src.colorType() == kN32_SkColorType);
unsigned flags32 = 0;
@@ -37,9 +37,9 @@ 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->addr32(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();
+ size_t srcRB = fSource.rowBytes();
SkBlitRow::Proc32 proc = fProc32;
U8CPU alpha = fAlpha;
@@ -61,8 +61,7 @@ private:
class Sprite_D32_XferFilter : public SkSpriteBlitter {
public:
- Sprite_D32_XferFilter(const SkBitmap& source, const SkPaint& paint)
- : SkSpriteBlitter(source) {
+ Sprite_D32_XferFilter(const SkPixmap& source, const SkPaint& paint) : SkSpriteBlitter(source) {
fColorFilter = paint.getColorFilter();
SkSafeRef(fColorFilter);
@@ -90,10 +89,8 @@ public:
SkSafeUnref(fColorFilter);
}
- bool setup(const SkBitmap& device, int left, int top, const SkPaint& paint) override {
- if (!this->INHERITED::setup(device, left, top, paint)) {
- return false;
- }
+ void setup(const SkBitmap& device, int left, int top, const SkPaint& paint) override {
+ this->INHERITED::setup(device, left, top, paint);
int width = device.width();
if (width > fBufferSize) {
@@ -101,7 +98,6 @@ public:
delete[] fBuffer;
fBuffer = new SkPMColor[width];
}
- return true;
}
protected:
@@ -120,15 +116,15 @@ private:
class Sprite_D32_S32A_XferFilter : public Sprite_D32_XferFilter {
public:
- Sprite_D32_S32A_XferFilter(const SkBitmap& source, const SkPaint& paint)
+ Sprite_D32_S32A_XferFilter(const SkPixmap& source, const SkPaint& paint)
: Sprite_D32_XferFilter(source, paint) {}
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->addr32(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();
+ size_t srcRB = fSource.rowBytes();
SkColorFilter* colorFilter = fColorFilter;
SkXfermode* xfermode = fXfermode;
@@ -166,15 +162,15 @@ static void fillbuffer(SkPMColor* SK_RESTRICT dst,
class Sprite_D32_S4444_XferFilter : public Sprite_D32_XferFilter {
public:
- Sprite_D32_S4444_XferFilter(const SkBitmap& source, const SkPaint& paint)
+ Sprite_D32_S4444_XferFilter(const SkPixmap& source, const SkPaint& paint)
: Sprite_D32_XferFilter(source, paint) {}
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->addr16(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();
+ size_t srcRB = fSource.rowBytes();
SkPMColor* SK_RESTRICT buffer = fBuffer;
SkColorFilter* colorFilter = fColorFilter;
SkXfermode* xfermode = fXfermode;
@@ -213,14 +209,14 @@ static void src_row(SkPMColor* SK_RESTRICT dst,
class Sprite_D32_S4444_Opaque : public SkSpriteBlitter {
public:
- Sprite_D32_S4444_Opaque(const SkBitmap& source) : SkSpriteBlitter(source) {}
+ Sprite_D32_S4444_Opaque(const SkPixmap& source) : SkSpriteBlitter(source) {}
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->addr16(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();
+ size_t srcRB = fSource.rowBytes();
do {
src_row(dst, src, width);
@@ -241,14 +237,14 @@ static void srcover_row(SkPMColor* SK_RESTRICT dst,
class Sprite_D32_S4444 : public SkSpriteBlitter {
public:
- Sprite_D32_S4444(const SkBitmap& source) : SkSpriteBlitter(source) {}
+ Sprite_D32_S4444(const SkPixmap& source) : SkSpriteBlitter(source) {}
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->addr16(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();
+ size_t srcRB = fSource.rowBytes();
do {
srcover_row(dst, src, width);
@@ -260,7 +256,7 @@ public:
///////////////////////////////////////////////////////////////////////////////
-SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source, const SkPaint& paint,
+SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkPixmap& source, const SkPaint& paint,
SkTBlitterAllocator* allocator) {
SkASSERT(allocator != NULL);
« no previous file with comments | « src/core/SkSpriteBlitterTemplate.h ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698