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

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

Issue 1229933003: add runtime option to provide data->imagegenerator factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 size_t rb, const Options& options, 123 size_t rb, const Options& options,
124 SkPMColor* colors, int* c olorCount) { 124 SkPMColor* colors, int* c olorCount) {
125 return kUnimplemented; 125 return kUnimplemented;
126 } 126 }
127 #else 127 #else
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
134 //////////////////////////////////////////////////////////////////////////////// ///////////////////
135
136 #include "SkGraphics.h"
137
138 static SkGraphics::ImageGeneratorFromEncodedFactory gImageGeneratorFromEncodedFa ctory;
139
140 SkGraphics::ImageGeneratorFromEncodedFactory SkGraphics::GetImageGeneratorFromEn codedFactory() {
141 return gImageGeneratorFromEncodedFactory;
142 }
143
144 void SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFa ctory factory) {
145 gImageGeneratorFromEncodedFactory = factory;
146 }
147
148 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) {
149 if (NULL == data) {
150 return NULL;
151 }
152 if (gImageGeneratorFromEncodedFactory) {
153 if (SkImageGenerator* generator = gImageGeneratorFromEncodedFactory(data )) {
154 return generator;
155 }
156 }
157 return SkImageGenerator::NewFromEncodedImpl(data);
158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698