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

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

Issue 1223413002: remove getter for imagegenerator factory, update test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: document that SkData will never be null Created 5 years, 5 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') | tests/ImageGeneratorTest.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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb , 128 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb ,
129 SkPMColor* colors, int* colorCount) { 129 SkPMColor* colors, int* colorCount) {
130 return false; 130 return false;
131 } 131 }
132 #endif 132 #endif
133 133
134 //////////////////////////////////////////////////////////////////////////////// /////////////////// 134 //////////////////////////////////////////////////////////////////////////////// ///////////////////
135 135
136 #include "SkGraphics.h" 136 #include "SkGraphics.h"
137 137
138 static SkGraphics::ImageGeneratorFromEncodedFactory gImageGeneratorFromEncodedFa ctory; 138 static SkGraphics::ImageGeneratorFromEncodedFactory gFactory;
139 139
140 SkGraphics::ImageGeneratorFromEncodedFactory SkGraphics::GetImageGeneratorFromEn codedFactory() { 140 SkGraphics::ImageGeneratorFromEncodedFactory
141 return gImageGeneratorFromEncodedFactory; 141 SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory factory)
142 } 142 {
143 143 ImageGeneratorFromEncodedFactory prev = gFactory;
144 void SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFa ctory factory) { 144 gFactory = factory;
145 gImageGeneratorFromEncodedFactory = factory; 145 return prev;
146 } 146 }
147 147
148 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) { 148 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) {
149 if (NULL == data) { 149 if (NULL == data) {
150 return NULL; 150 return NULL;
151 } 151 }
152 if (gImageGeneratorFromEncodedFactory) { 152 if (gFactory) {
153 if (SkImageGenerator* generator = gImageGeneratorFromEncodedFactory(data )) { 153 if (SkImageGenerator* generator = gFactory(data)) {
154 return generator; 154 return generator;
155 } 155 }
156 } 156 }
157 return SkImageGenerator::NewFromEncodedImpl(data); 157 return SkImageGenerator::NewFromEncodedImpl(data);
158 } 158 }
OLDNEW
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | tests/ImageGeneratorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698