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

Side by Side Diff: src/effects/SkTableColorFilter.cpp

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 11 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 | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/gpu/GrSWMaskHelper.cpp » ('j') | 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 #include "SkBitmap.h" 2 #include "SkBitmap.h"
3 #include "SkTableColorFilter.h" 3 #include "SkTableColorFilter.h"
4 #include "SkColorPriv.h" 4 #include "SkColorPriv.h"
5 #include "SkFlattenableBuffers.h" 5 #include "SkFlattenableBuffers.h"
6 #include "SkUnPreMultiply.h" 6 #include "SkUnPreMultiply.h"
7 #include "SkString.h" 7 #include "SkString.h"
8 8
9 class SkTable_ColorFilter : public SkColorFilter { 9 class SkTable_ColorFilter : public SkColorFilter {
10 public: 10 public:
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 SkASSERT(raw <= sizeof(fStorage)); 197 SkASSERT(raw <= sizeof(fStorage));
198 SkDEBUGCODE(size_t count = gCountNibBits[fFlags & 0xF]); 198 SkDEBUGCODE(size_t count = gCountNibBits[fFlags & 0xF]);
199 SkASSERT(raw == count * 256); 199 SkASSERT(raw == count * 256);
200 } 200 }
201 201
202 bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) const { 202 bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) const {
203 if (table) { 203 if (table) {
204 if (NULL == fBitmap) { 204 if (NULL == fBitmap) {
205 SkBitmap* bmp = SkNEW(SkBitmap); 205 SkBitmap* bmp = SkNEW(SkBitmap);
206 bmp->setConfig(SkBitmap::kA8_Config, 256, 4, 256); 206 bmp->allocPixels(SkImageInfo::MakeA8(256, 4));
207 bmp->allocPixels();
208 uint8_t* bitmapPixels = bmp->getAddr8(0, 0); 207 uint8_t* bitmapPixels = bmp->getAddr8(0, 0);
209 int offset = 0; 208 int offset = 0;
210 static const unsigned kFlags[] = { kA_Flag, kR_Flag, kG_Flag, kB_Fla g }; 209 static const unsigned kFlags[] = { kA_Flag, kR_Flag, kG_Flag, kB_Fla g };
211 210
212 for (int x = 0; x < 4; ++x) { 211 for (int x = 0; x < 4; ++x) {
213 if (!(fFlags & kFlags[x])) { 212 if (!(fFlags & kFlags[x])) {
214 memcpy(bitmapPixels, gIdentityTable, sizeof(gIdentityTable)) ; 213 memcpy(bitmapPixels, gIdentityTable, sizeof(gIdentityTable)) ;
215 } else { 214 } else {
216 memcpy(bitmapPixels, fStorage + offset, 256); 215 memcpy(bitmapPixels, fStorage + offset, 256);
217 offset += 256; 216 offset += 256;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], 424 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
426 const uint8_t tableR[256], 425 const uint8_t tableR[256],
427 const uint8_t tableG[256], 426 const uint8_t tableG[256],
428 const uint8_t tableB[256]) { 427 const uint8_t tableB[256]) {
429 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); 428 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB));
430 } 429 }
431 430
432 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) 431 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
433 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) 432 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter)
434 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 433 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/gpu/GrSWMaskHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698