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

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 1777863003: TBR=robertphillips@google.com (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkImage.cpp ('k') | tests/ImageTest.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 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 "GrCaps.h" 8 #include "GrCaps.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return create_image_from_maker(&maker, at, this->uniqueID()); 303 return create_image_from_maker(&maker, at, this->uniqueID());
304 } 304 }
305 SkBitmap bmp; 305 SkBitmap bmp;
306 if (!this->asLegacyBitmap(&bmp, kRO_LegacyBitmapMode)) { 306 if (!this->asLegacyBitmap(&bmp, kRO_LegacyBitmapMode)) {
307 return nullptr; 307 return nullptr;
308 } 308 }
309 GrBitmapTextureMaker maker(context, bmp); 309 GrBitmapTextureMaker maker(context, bmp);
310 return create_image_from_maker(&maker, at, this->uniqueID()); 310 return create_image_from_maker(&maker, at, this->uniqueID());
311 } 311 }
312 312
313 SkImage* SkImage::NewTextureFromPixmap(GrContext* ctx, const SkPixmap& pixmap,
314 SkBudgeted budgeted) {
315 if (!ctx) {
316 return nullptr;
317 }
318 SkAutoTUnref<GrTexture> texture(GrUploadPixmapToTexture(ctx, pixmap));
319 if (!texture) {
320 return nullptr;
321 }
322 return new SkImage_Gpu(texture->width(), texture->height(), kNeedNewImageUni queID,
323 pixmap.alphaType(), texture, budgeted);
324 }
325
326 //////////////////////////////////////////////////////////////////////////////// /////////////////// 313 //////////////////////////////////////////////////////////////////////////////// ///////////////////
327 314
328 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted budgeted) { 315 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted budgeted) {
329 GrContext* ctx = src->getContext(); 316 GrContext* ctx = src->getContext();
330 317
331 GrSurfaceDesc desc = src->desc(); 318 GrSurfaceDesc desc = src->desc();
332 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, nullp tr, 0); 319 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, nullp tr, 0);
333 if (!dst) { 320 if (!dst) {
334 return nullptr; 321 return nullptr;
335 } 322 }
336 323
337 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 324 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
338 const SkIPoint dstP = SkIPoint::Make(0, 0); 325 const SkIPoint dstP = SkIPoint::Make(0, 0);
339 ctx->copySurface(dst, src, srcR, dstP); 326 ctx->copySurface(dst, src, srcR, dstP);
340 ctx->flushSurfaceWrites(dst); 327 ctx->flushSurfaceWrites(dst);
341 return dst; 328 return dst;
342 } 329 }
343 330
OLDNEW
« no previous file with comments | « src/image/SkImage.cpp ('k') | tests/ImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698