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/image/SkImage.cpp

Issue 855473002: initial preroll api (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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/core/SkPictureShader.cpp ('k') | src/image/SkImage_Base.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 } 112 }
113 113
114 if (NULL == subset && this->width() == newWidth && this->height() == newHeig ht) { 114 if (NULL == subset && this->width() == newWidth && this->height() == newHeig ht) {
115 return SkRef(const_cast<SkImage*>(this)); 115 return SkRef(const_cast<SkImage*>(this));
116 } 116 }
117 117
118 return as_IB(this)->onNewImage(newWidth, newHeight, subset, quality); 118 return as_IB(this)->onNewImage(newWidth, newHeight, subset, quality);
119 } 119 }
120 120
121 void SkImage::preroll() const {
122 as_IB(this)->onPreroll();
123 }
124
121 /////////////////////////////////////////////////////////////////////////////// 125 ///////////////////////////////////////////////////////////////////////////////
122 126
123 static bool raster_canvas_supports(const SkImageInfo& info) { 127 static bool raster_canvas_supports(const SkImageInfo& info) {
124 switch (info.colorType()) { 128 switch (info.colorType()) {
125 case kN32_SkColorType: 129 case kN32_SkColorType:
126 return kUnpremul_SkAlphaType != info.alphaType(); 130 return kUnpremul_SkAlphaType != info.alphaType();
127 case kRGB_565_SkColorType: 131 case kRGB_565_SkColorType:
128 return true; 132 return true;
129 case kAlpha_8_SkColorType: 133 case kAlpha_8_SkColorType:
130 return true; 134 return true;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 surface->getCanvas()->translate(-src.x(), -src.y()); 176 surface->getCanvas()->translate(-src.x(), -src.y());
173 177
174 SkPaint paint; 178 SkPaint paint;
175 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 179 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
176 paint.setFilterQuality(quality); 180 paint.setFilterQuality(quality);
177 surface->getCanvas()->drawImage(this, 0, 0, &paint); 181 surface->getCanvas()->drawImage(this, 0, 0, &paint);
178 return surface->newImageSnapshot(); 182 return surface->newImageSnapshot();
179 } 183 }
180 184
181 185
OLDNEW
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698