Chromium Code Reviews| Index: src/gpu/GrAtlas.cpp |
| diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp |
| index b3f2e34c40e5ab1b79bcb4659761a1268af85165..a2756c59c664740facfa71613a83d6cbe8e2a319 100644 |
| --- a/src/gpu/GrAtlas.cpp |
| +++ b/src/gpu/GrAtlas.cpp |
| @@ -50,7 +50,7 @@ |
| static int g_UploadCount = 0; |
| #endif |
| -GrAtlas::GrAtlas(GrAtlasMgr* mgr, int plotX, int plotY, GrMaskFormat format) : |
| +GrAtlas::GrAtlas(GrAtlasMgr* mgr, int plotX, int plotY, int bpp) : |
| fDrawToken(NULL, 0) { |
| fAtlasMgr = mgr; // just a pointer, not an owner |
| fNext = NULL; |
| @@ -61,7 +61,7 @@ GrAtlas::GrAtlas(GrAtlasMgr* mgr, int plotX, int plotY, GrMaskFormat format) : |
| fRects = GrRectanizer::Factory(GR_ATLAS_WIDTH - BORDER, |
| GR_ATLAS_HEIGHT - BORDER); |
| - fMaskFormat = format; |
| + fBytesPerPixel = bpp; |
| #ifdef SK_DEBUG |
| // GrPrintf(" GrAtlas %p [%d %d] %d\n", this, plotX, plotY, gCounter); |
| @@ -123,7 +123,7 @@ bool GrAtlas::addSubImage(int width, int height, const void* image, |
| int dstW = width + 2*BORDER; |
| int dstH = height + 2*BORDER; |
| if (BORDER) { |
|
robertphillips
2013/09/26 13:47:35
Replace bpp with fBytesPerPixel?
jvanverth1
2013/09/26 15:16:07
Done.
|
| - const int bpp = GrMaskFormatBytesPerPixel(fMaskFormat); |
| + const int bpp = fBytesPerPixel; |
| const size_t dstRB = dstW * bpp; |
| uint8_t* dst = (uint8_t*)storage.reset(dstH * dstRB); |
| Gr_bzero(dst, dstRB); // zero top row |
| @@ -161,9 +161,9 @@ bool GrAtlas::addSubImage(int width, int height, const void* image, |
| /////////////////////////////////////////////////////////////////////////////// |
| -GrAtlasMgr::GrAtlasMgr(GrGpu* gpu, GrMaskFormat format) { |
| +GrAtlasMgr::GrAtlasMgr(GrGpu* gpu, GrPixelConfig config) { |
| fGpu = gpu; |
| - fMaskFormat = format; |
| + fPixelConfig = config; |
| gpu->ref(); |
| fTexture = NULL; |
| fPlotMgr = SkNEW_ARGS(GrPlotMgr, (GR_PLOT_WIDTH, GR_PLOT_HEIGHT)); |
| @@ -179,20 +179,6 @@ GrAtlasMgr::~GrAtlasMgr() { |
| #endif |
| } |
| -static GrPixelConfig maskformat2pixelconfig(GrMaskFormat format) { |
| - switch (format) { |
| - case kA8_GrMaskFormat: |
| - return kAlpha_8_GrPixelConfig; |
| - case kA565_GrMaskFormat: |
| - return kRGB_565_GrPixelConfig; |
| - case kA888_GrMaskFormat: |
| - return kSkia8888_GrPixelConfig; |
| - default: |
| - SkDEBUGFAIL("unknown maskformat"); |
| - } |
| - return kUnknown_GrPixelConfig; |
| -} |
| - |
| GrAtlas* GrAtlasMgr::addToAtlas(GrAtlas** atlas, |
| int width, int height, const void* image, |
| GrIPoint16* loc) { |
| @@ -219,7 +205,7 @@ GrAtlas* GrAtlasMgr::addToAtlas(GrAtlas** atlas, |
| desc.fFlags = kDynamicUpdate_GrTextureFlagBit; |
| desc.fWidth = GR_ATLAS_TEXTURE_WIDTH; |
| desc.fHeight = GR_ATLAS_TEXTURE_HEIGHT; |
| - desc.fConfig = maskformat2pixelconfig(fMaskFormat); |
| + desc.fConfig = fPixelConfig; |
| fTexture = fGpu->createTexture(desc, NULL, 0); |
| if (NULL == fTexture) { |
| @@ -227,7 +213,8 @@ GrAtlas* GrAtlasMgr::addToAtlas(GrAtlas** atlas, |
| } |
| } |
| - GrAtlas* newAtlas = SkNEW_ARGS(GrAtlas, (this, plot.fX, plot.fY, fMaskFormat)); |
| + int bpp = GrBytesPerPixel(fPixelConfig); |
| + GrAtlas* newAtlas = SkNEW_ARGS(GrAtlas, (this, plot.fX, plot.fY, bpp)); |
| if (!newAtlas->addSubImage(width, height, image, loc)) { |
| delete newAtlas; |
| return NULL; |