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

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

Issue 1263013002: Remove SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « include/core/SkImageGenerator.h ('k') | src/images/SkDecodingImageGenerator.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImageGenerator.h" 8 #include "SkImageGenerator.h"
9 9
10 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes, 10 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes,
(...skipping 13 matching lines...) Expand all
24 return false; 24 return false;
25 } 25 }
26 } else { 26 } else {
27 if (ctableCount) { 27 if (ctableCount) {
28 *ctableCount = 0; 28 *ctableCount = 0;
29 } 29 }
30 ctableCount = NULL; 30 ctableCount = NULL;
31 ctable = NULL; 31 ctable = NULL;
32 } 32 }
33 33
34 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
35 // Default options.
36 Options options;
37 const Result result = this->onGetPixels(info, pixels, rowBytes, options, cta ble, ctableCount);
38
39 if (kIncompleteInput != result && kSuccess != result) {
40 return false;
41 }
42 if (ctableCount) {
43 SkASSERT(*ctableCount >= 0 && *ctableCount <= 256);
44 }
45 return true;
46 #else
47 const bool success = this->onGetPixels(info, pixels, rowBytes, ctable, ctabl eCount); 34 const bool success = this->onGetPixels(info, pixels, rowBytes, ctable, ctabl eCount);
48 if (success && ctableCount) { 35 if (success && ctableCount) {
49 SkASSERT(*ctableCount >= 0 && *ctableCount <= 256); 36 SkASSERT(*ctableCount >= 0 && *ctableCount <= 256);
50 } 37 }
51 return success; 38 return success;
52 #endif
53 } 39 }
54 40
55 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes) { 41 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes) {
56 SkASSERT(kIndex_8_SkColorType != info.colorType()); 42 SkASSERT(kIndex_8_SkColorType != info.colorType());
57 if (kIndex_8_SkColorType == info.colorType()) { 43 if (kIndex_8_SkColorType == info.colorType()) {
58 return false; 44 return false;
59 } 45 }
60 return this->getPixels(info, pixels, rowBytes, NULL, NULL); 46 return this->getPixels(info, pixels, rowBytes, NULL, NULL);
61 } 47 }
62 48
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 97 }
112 return this->onGetYUV8Planes(sizes, planes, rowBytes); 98 return this->onGetYUV8Planes(sizes, planes, rowBytes);
113 } 99 }
114 100
115 //////////////////////////////////////////////////////////////////////////////// ///////////// 101 //////////////////////////////////////////////////////////////////////////////// /////////////
116 102
117 SkData* SkImageGenerator::onRefEncodedData() { 103 SkData* SkImageGenerator::onRefEncodedData() {
118 return NULL; 104 return NULL;
119 } 105 }
120 106
121 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
122 SkImageGenerator::Result SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst,
123 size_t rb, const Options& options,
124 SkPMColor* colors, int* c olorCount) {
125 return kUnimplemented;
126 }
127 #else
128 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb , 107 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb ,
129 SkPMColor* colors, int* colorCount) { 108 SkPMColor* colors, int* colorCount) {
130 return false; 109 return false;
131 } 110 }
132 #endif
133 111
134 //////////////////////////////////////////////////////////////////////////////// /////////////////// 112 //////////////////////////////////////////////////////////////////////////////// ///////////////////
135 113
136 #include "SkGraphics.h" 114 #include "SkGraphics.h"
137 115
138 static SkGraphics::ImageGeneratorFromEncodedFactory gFactory; 116 static SkGraphics::ImageGeneratorFromEncodedFactory gFactory;
139 117
140 SkGraphics::ImageGeneratorFromEncodedFactory 118 SkGraphics::ImageGeneratorFromEncodedFactory
141 SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory factory) 119 SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory factory)
142 { 120 {
143 ImageGeneratorFromEncodedFactory prev = gFactory; 121 ImageGeneratorFromEncodedFactory prev = gFactory;
144 gFactory = factory; 122 gFactory = factory;
145 return prev; 123 return prev;
146 } 124 }
147 125
148 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) { 126 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) {
149 if (NULL == data) { 127 if (NULL == data) {
150 return NULL; 128 return NULL;
151 } 129 }
152 if (gFactory) { 130 if (gFactory) {
153 if (SkImageGenerator* generator = gFactory(data)) { 131 if (SkImageGenerator* generator = gFactory(data)) {
154 return generator; 132 return generator;
155 } 133 }
156 } 134 }
157 return SkImageGenerator::NewFromEncodedImpl(data); 135 return SkImageGenerator::NewFromEncodedImpl(data);
158 } 136 }
OLDNEW
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698