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

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

Issue 1728093005: Move Budgeted enum out of SkSurface, use in GrTextureProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add aliases for Chrome Created 4 years, 9 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/SkImageCacherator.cpp ('k') | src/effects/GrCircleBlurFragmentProcessor.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 2015 Google Inc. 2 * Copyright 2015 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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkMatrix.h" 10 #include "SkMatrix.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #if SK_SUPPORT_GPU 131 #if SK_SUPPORT_GPU
132 #include "GrTexture.h" 132 #include "GrTexture.h"
133 133
134 GrTexture* SkPictureImageGenerator::onGenerateTexture(GrContext* ctx, const SkIR ect* subset) { 134 GrTexture* SkPictureImageGenerator::onGenerateTexture(GrContext* ctx, const SkIR ect* subset) {
135 const SkImageInfo& info = this->getInfo(); 135 const SkImageInfo& info = this->getInfo();
136 SkImageInfo surfaceInfo = subset ? info.makeWH(subset->width(), subset->heig ht()) : info; 136 SkImageInfo surfaceInfo = subset ? info.makeWH(subset->width(), subset->heig ht()) : info;
137 137
138 // 138 //
139 // TODO: respect the usage, by possibly creating a different (pow2) surface 139 // TODO: respect the usage, by possibly creating a different (pow2) surface
140 // 140 //
141 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, 141 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted:: kYes,
142 SkSurface::kYes_B udgeted,
143 surfaceInfo)); 142 surfaceInfo));
144 if (!surface.get()) { 143 if (!surface.get()) {
145 return nullptr; 144 return nullptr;
146 } 145 }
147 146
148 SkMatrix matrix = fMatrix; 147 SkMatrix matrix = fMatrix;
149 if (subset) { 148 if (subset) {
150 matrix.postTranslate(-subset->x(), -subset->y()); 149 matrix.postTranslate(-subset->x(), -subset->y());
151 } 150 }
152 surface->getCanvas()->clear(0); // does NewRenderTarget promise to do this f or us? 151 surface->getCanvas()->clear(0); // does NewRenderTarget promise to do this f or us?
153 surface->getCanvas()->drawPicture(fPicture, &matrix, fPaint.getMaybeNull()); 152 surface->getCanvas()->drawPicture(fPicture, &matrix, fPaint.getMaybeNull());
154 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); 153 SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
155 if (!image.get()) { 154 if (!image.get()) {
156 return nullptr; 155 return nullptr;
157 } 156 }
158 return SkSafeRef(image->getTexture()); 157 return SkSafeRef(image->getTexture());
159 } 158 }
160 #endif 159 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/effects/GrCircleBlurFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698