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

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

Issue 1424313010: Separate out natively-texture image/bmp draws from cached-as-texture image/bmp draws (Closed) Base URL: https://skia.googlesource.com/skia.git@const
Patch Set: update Created 5 years, 1 month 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/GrStrokeInfo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrImageIDTextureAdjuster.h"
9
10 #include "SkBitmap.h"
11 #include "SkGrPriv.h"
12 #include "SkImage_Base.h"
13
14
15 GrBitmapTextureAdjuster::GrBitmapTextureAdjuster(const SkBitmap* bmp)
16 : INHERITED(bmp->getTexture(), SkIRect::MakeWH(bmp->width(), bmp->height()))
17 , fBmp(bmp) {}
18
19 void GrBitmapTextureAdjuster::makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) {
20 if (fBmp->isVolatile()) {
21 return;
22 }
23 // The content area must represent the whole bitmap. Texture-backed bitmaps don't support
24 // extractSubset(). Therefore, either the bitmap and the texture are the sam e size or the
25 // content's dimensions are the bitmap's dimensions which is pinned to the u pper left
26 // of the texture.
27 GrUniqueKey baseKey;
28 GrMakeKeyFromImageID(&baseKey, fBmp->getGenerationID(),
29 SkIRect::MakeWH(fBmp->width(), fBmp->height()));
30 MakeCopyKeyFromOrigKey(baseKey, params, copyKey);
31 }
32
33 void GrBitmapTextureAdjuster::didCacheCopy(const GrUniqueKey& copyKey) {
34 GrInstallBitmapUniqueKeyInvalidator(copyKey, fBmp->pixelRef());
35 }
36
37 //////////////////////////////////////////////////////////////////////////////
38
39 GrImageTextureAdjuster::GrImageTextureAdjuster(const SkImage_Base* img)
40 : INHERITED(img->peekTexture(), SkIRect::MakeWH(img->width(), img->height()) )
41 , fImageBase(img) {}
42
43 void GrImageTextureAdjuster::makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) {
44 // By construction this texture adjuster always represents an entire SkImage , so use the
45 // image's width and height for the key's rectangle.
46 GrUniqueKey baseKey;
47 GrMakeKeyFromImageID(&baseKey, fImageBase->uniqueID(),
48 SkIRect::MakeWH(fImageBase->width(), fImageBase->height ()));
49 MakeCopyKeyFromOrigKey(baseKey, params, copyKey);
50 }
51
52 void GrImageTextureAdjuster::didCacheCopy(const GrUniqueKey& copyKey) {
53 // We don't currently have a mechanism for notifications on Images!
54 }
OLDNEW
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/GrStrokeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698