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

Side by Side Diff: src/utils/SkImageGeneratorUtils.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/image/SkSurface_Raster.cpp ('k') | tests/BitmapCopyTest.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 "SkImageGeneratorUtils.h" 8 #include "SkImageGeneratorUtils.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 if (!subset) { 64 if (!subset) {
65 return SkRef(fTexture.get()); 65 return SkRef(fTexture.get());
66 } 66 }
67 // need to copy the subset into a new texture 67 // need to copy the subset into a new texture
68 GrSurfaceDesc desc = fTexture->desc(); 68 GrSurfaceDesc desc = fTexture->desc();
69 desc.fWidth = subset->width(); 69 desc.fWidth = subset->width();
70 desc.fHeight = subset->height(); 70 desc.fHeight = subset->height();
71 71
72 GrTexture* dst = fCtx->textureProvider()->createTexture(desc, false); 72 GrTexture* dst = fCtx->textureProvider()->createTexture(desc, SkBudgeted ::kNo);
73 fCtx->copySurface(dst, fTexture, *subset, SkIPoint::Make(0, 0)); 73 fCtx->copySurface(dst, fTexture, *subset, SkIPoint::Make(0, 0));
74 return dst; 74 return dst;
75 } 75 }
76 private: 76 private:
77 SkAutoTUnref<GrContext> fCtx; 77 SkAutoTUnref<GrContext> fCtx;
78 SkAutoTUnref<GrTexture> fTexture; 78 SkAutoTUnref<GrTexture> fTexture;
79 }; 79 };
80 #endif 80 #endif
81 81
82 SkImageGenerator* SkImageGeneratorUtils::NewFromTexture(GrContext* ctx, GrTextur e* tex) { 82 SkImageGenerator* SkImageGeneratorUtils::NewFromTexture(GrContext* ctx, GrTextur e* tex) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (image) { 125 if (image) {
126 const SkColorType ct = kN32_SkColorType; 126 const SkColorType ct = kN32_SkColorType;
127 const SkAlphaType at = image->isOpaque() ? kOpaque_SkAlphaType : kPremul _SkAlphaType; 127 const SkAlphaType at = image->isOpaque() ? kOpaque_SkAlphaType : kPremul _SkAlphaType;
128 const SkImageInfo info = SkImageInfo::Make(image->width(), image->height (), ct, at); 128 const SkImageInfo info = SkImageInfo::Make(image->width(), image->height (), ct, at);
129 return new GeneratorFromImage(image, info); 129 return new GeneratorFromImage(image, info);
130 } 130 }
131 return nullptr; 131 return nullptr;
132 } 132 }
133 133
134 134
OLDNEW
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698