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

Side by Side Diff: src/images/SkImageGenerator.cpp

Issue 304443003: add colortable support to imagegenerator (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix spelling Created 6 years, 6 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/images/SkDecodingImageGenerator.cpp ('k') | src/lazy/SkDiscardablePixelRef.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkImageGenerator.h"
9
10 #ifndef SK_SUPPORT_LEGACY_IMAGEGENERATORAPI
11 bool SkImageGenerator::getInfo(SkImageInfo* info) {
12 SkImageInfo dummy;
13 if (NULL == info) {
14 info = &dummy;
15 }
16 return this->onGetInfo(info);
17 }
18
19 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes,
20 SkPMColor ctable[], int* ctableCount) {
21 // Dummy (out-of-range) value to catch subclasses that forgot to respect cta ble params.
22 int localCTableCount = -1;
23 int* localCTableCountPtr = NULL;
24
25 if (kIndex_8_SkColorType == info.colorType()) {
26 if (NULL == ctable || NULL == ctableCount) {
27 return false;
28 }
29 } else {
30 if (ctableCount) {
31 *ctableCount = 0;
32 }
33 ctableCount = NULL;
34 ctable = NULL;
35 }
36
37 if (kUnknown_SkColorType == info.colorType()) {
38 return false;
39 }
40 if (NULL == pixels) {
41 return false;
42 }
43 if (rowBytes < info.minRowBytes()) {
44 return false;
45 }
46
47 bool success = this->onGetPixels(info, pixels, rowBytes, ctable, localCTable CountPtr);
48
49 if (success && localCTableCountPtr) {
50 SkASSERT(localCTableCount >= 0 && localCTableCount <= 256);
51 if (ctableCount) {
52 *ctableCount = localCTableCount;
53 }
54 }
55 return success;
56 }
57
58 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes) {
59 SkASSERT(kIndex_8_SkColorType != info.colorType());
60 if (kIndex_8_SkColorType == info.colorType()) {
61 return false;
62 }
63 return this->getPixels(info, pixels, rowBytes, NULL, NULL);
64 }
65 #endif
66
67 //////////////////////////////////////////////////////////////////////////////// /////////////
68
69 SkData* SkImageGenerator::onRefEncodedData() {
70 return NULL;
71 }
72
73 bool SkImageGenerator::onGetInfo(SkImageInfo*) {
74 return false;
75 }
76
77 bool SkImageGenerator::onGetPixels(const SkImageInfo&, void*, size_t, SkPMColor* , int*) {
78 return false;
79 }
OLDNEW
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/lazy/SkDiscardablePixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698