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

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

Issue 300263005: Revert "Revert of add colortable support to imagegenerator (https://codereview.chromium.org/3044430… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
« 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 if (kUnknown_SkColorType == info.colorType()) {
22 return false;
23 }
24 if (NULL == pixels) {
25 return false;
26 }
27 if (rowBytes < info.minRowBytes()) {
28 return false;
29 }
30
31 if (kIndex_8_SkColorType == info.colorType()) {
32 if (NULL == ctable || NULL == ctableCount) {
33 return false;
34 }
35 } else {
36 if (ctableCount) {
37 *ctableCount = 0;
38 }
39 ctableCount = NULL;
40 ctable = NULL;
41 }
42
43 bool success = this->onGetPixels(info, pixels, rowBytes, ctable, ctableCount );
44
45 if (success && ctableCount) {
46 SkASSERT(*ctableCount >= 0 && *ctableCount <= 256);
47 }
48 return success;
49 }
50
51 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes) {
52 SkASSERT(kIndex_8_SkColorType != info.colorType());
53 if (kIndex_8_SkColorType == info.colorType()) {
54 return false;
55 }
56 return this->getPixels(info, pixels, rowBytes, NULL, NULL);
57 }
58 #endif
59
60 //////////////////////////////////////////////////////////////////////////////// /////////////
61
62 SkData* SkImageGenerator::onRefEncodedData() {
63 return NULL;
64 }
65
66 bool SkImageGenerator::onGetInfo(SkImageInfo*) {
67 return false;
68 }
69
70 bool SkImageGenerator::onGetPixels(const SkImageInfo&, void*, size_t, SkPMColor* , int*) {
71 return false;
72 }
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