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

Side by Side Diff: src/gpu/GrImageIDTextureAdjuster.cpp

Issue 2241353002: pin as texture api (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comments Created 4 years, 4 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/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/SkGpuDevice.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 "GrImageIDTextureAdjuster.h" 8 #include "GrImageIDTextureAdjuster.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
11 #include "GrGpuResourcePriv.h" 11 #include "GrGpuResourcePriv.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkGrPriv.h" 13 #include "SkGrPriv.h"
14 #include "SkImage_Base.h" 14 #include "SkImage_Base.h"
15 #include "SkImageCacherator.h" 15 #include "SkImageCacherator.h"
16 #include "SkPixelRef.h" 16 #include "SkPixelRef.h"
17 17
18 static bool bmp_is_alpha_only(const SkBitmap& bm) { return kAlpha_8_SkColorType == bm.colorType(); } 18 static bool bmp_is_alpha_only(const SkBitmap& bm) { return kAlpha_8_SkColorType == bm.colorType(); }
19 19
20 // By construction this texture adjuster always represents an entire SkImage, so use the
21 // image's dimensions for the key's rectangle.
22 GrImageTextureAdjuster::GrImageTextureAdjuster(const SkImage_Base* img)
23 : GrTextureAdjuster(img->peekTexture(), SkIRect::MakeSize(img->dimensions()) , img->uniqueID(),
24 img->onImageInfo().colorSpace())
25 {
26 SkASSERT(img->peekTexture());
27 }
28
29 //////////////////////////////////////////////////////////////////////////////
30
31 GrBitmapTextureMaker::GrBitmapTextureMaker(GrContext* context, const SkBitmap& b itmap) 20 GrBitmapTextureMaker::GrBitmapTextureMaker(GrContext* context, const SkBitmap& b itmap)
32 : INHERITED(context, bitmap.width(), bitmap.height(), bmp_is_alpha_only(bitm ap)) 21 : INHERITED(context, bitmap.width(), bitmap.height(), bmp_is_alpha_only(bitm ap))
33 , fBitmap(bitmap) 22 , fBitmap(bitmap)
34 { 23 {
35 if (!bitmap.isVolatile()) { 24 if (!bitmap.isVolatile()) {
36 SkIPoint origin = bitmap.pixelRefOrigin(); 25 SkIPoint origin = bitmap.pixelRefOrigin();
37 SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bitmap.width(), 26 SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bitmap.width(),
38 bitmap.height()); 27 bitmap.height());
39 GrMakeKeyFromImageID(&fOriginalKey, bitmap.pixelRef()->getGenerationID() , subset); 28 GrMakeKeyFromImageID(&fOriginalKey, bitmap.pixelRef()->getGenerationID() , subset);
40 } 29 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 97
109 void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) { 98 void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
110 if (fClient) { 99 if (fClient) {
111 as_IB(fClient)->notifyAddedToCache(); 100 as_IB(fClient)->notifyAddedToCache();
112 } 101 }
113 } 102 }
114 103
115 SkColorSpace* GrImageTextureMaker::getColorSpace() { 104 SkColorSpace* GrImageTextureMaker::getColorSpace() {
116 return fCacher->info().colorSpace(); 105 return fCacher->info().colorSpace();
117 } 106 }
OLDNEW
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698