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

Side by Side Diff: src/gpu/SkGrPriv.h

Issue 1411353002: Revert recent CLs around GrTextureMaker/GrTextureParamsAdjuster (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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/SkGr.cpp ('k') | src/image/SkImage_Gpu.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 #ifndef SkGrPriv_DEFINED 8 #ifndef SkGrPriv_DEFINED
9 #define SkGrPriv_DEFINED 9 #define SkGrPriv_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "GrBlend.h" 12 #include "GrBlend.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkMatrix.h" 14 #include "SkMatrix.h"
15 #include "SkXfermode.h" 15 #include "SkXfermode.h"
16 16
17 class GrCaps; 17 class GrCaps;
18 class GrContext; 18 class GrContext;
19 class GrFragmentProcessor; 19 class GrFragmentProcessor;
20 class GrPaint; 20 class GrPaint;
21 class GrTexture; 21 class GrTexture;
22 class GrTextureParams; 22 class GrTextureParams;
23 class GrUniqueKey; 23 class GrUniqueKey;
24 class SkData; 24 class SkData;
25 class SkPaint; 25 class SkPaint;
26 class SkPixelRef; 26 class SkPixelRef;
27 struct SkIRect; 27 struct SkIRect;
28 28
29 struct SkGrStretch {
30 enum Type {
31 kNone_Type,
32 kBilerp_Type,
33 kNearest_Type
34 } fType;
35 int fWidth;
36 int fHeight;
37 };
38
29 /** 39 /**
30 * Our key includes the offset, width, and height so that bitmaps created by ex tractSubset() 40 * Our key includes the offset, width, and height so that bitmaps created by ex tractSubset()
31 * are unique. 41 * are unique.
32 * 42 *
33 * The imageID is in the shared namespace (see SkNextID::ImageID()) 43 * The imageID is in the shared namespace (see SkNextID::ImageID()
34 * - SkBitmap/SkPixelRef 44 * - SkBitmap/SkPixelRef
35 * - SkImage 45 * - SkImage
36 * - SkImageGenerator 46 * - SkImageGenerator
37 * 47 *
38 * Note: width/height must fit in 16bits for this impl. 48 * Note: width/height must fit in 16bits for this impl.
39 */ 49 */
40 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima geBounds); 50 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima geBounds,
51 const GrCaps&, const GrTextureParams&);
52
53 /**
54 * Given an "unstretched" key, and a stretch rec, produce a stretched key.
55 */
56 bool GrMakeStretchedKey(const GrUniqueKey& origKey, const SkGrStretch&, GrUnique Key* stretchedKey);
41 57
42 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir ed in order 58 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir ed in order
43 to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */ 59 to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */
44 bool SkPaintToGrPaint(GrContext*, 60 bool SkPaintToGrPaint(GrContext*,
45 const SkPaint& skPaint, 61 const SkPaint& skPaint,
46 const SkMatrix& viewM, 62 const SkMatrix& viewM,
47 GrPaint* grPaint); 63 GrPaint* grPaint);
48 64
49 /** Same as above but ignores the SkShader (if any) on skPaint. */ 65 /** Same as above but ignores the SkShader (if any) on skPaint. */
50 bool SkPaintToGrPaintNoShader(GrContext* context, 66 bool SkPaintToGrPaintNoShader(GrContext* context,
(...skipping 29 matching lines...) Expand all
80 false, grPaint); 96 false, grPaint);
81 } 97 }
82 98
83 ////////////////////////////////////////////////////////////////////////////// 99 //////////////////////////////////////////////////////////////////////////////
84 100
85 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&); 101 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&);
86 102
87 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi leType*); 103 bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfi leType*);
88 104
89 /** 105 /**
90 * If the compressed data in the SkData is supported (as a texture format, this returns 106 * If the compressed data in the SkData is supported (as a texture format, this returns
91 * the pixel-config that should be used, and sets outStartOfDataToUpload to the ptr into 107 * the pixel-config that should be used, and sets outStartOfDataToUpload to the ptr into
92 * the data where the actual raw data starts (skipping any header bytes). 108 * the data where the actual raw data starts (skipping any header bytes).
93 * 109 *
94 * If the compressed data is not supported, this returns kUnknown_GrPixelConfig , and 110 * If the compressed data is not supported, this returns kUnknown_GrPixelConfig, and
95 * ignores outStartOfDataToUpload. 111 * ignores outStartOfDataToUpload.
96 */ 112 */
97 GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, 113 GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data,
98 int expectedW, int expectedH, 114 int expectedW, int expectedH,
99 const void** outStartOfDataToUp load); 115 const void** outStartOfDataToUp load);
100 116
117 GrTexture* GrCreateTextureForPixels(GrContext*, const GrUniqueKey& optionalKey, GrSurfaceDesc,
118 SkPixelRef* pixelRefForInvalidationNotificat ionOrNull,
119 const void* pixels, size_t rowBytesOrZero);
101 120
102 /**
103 * Creates a new texture for the bitmap. Does not concern itself with cache keys or texture params.
104 * The bitmap must have CPU-accessible pixels. Attempts to take advantage of fas ter paths for
105 * compressed textures and yuv planes.
106 */
107 GrTexture* GrUploadBitmapToTexture(GrContext*, const SkBitmap&);
108 121
109 ////////////////////////////////////////////////////////////////////////////// 122 //////////////////////////////////////////////////////////////////////////////
110 123
111 GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff); 124 GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff);
112 GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff); 125 GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff);
113 GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff); 126 GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff);
114 GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff); 127 GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff);
115 GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff); 128 GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff);
116 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); 129 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff);
117 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); 130 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff);
118 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); 131 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff);
119 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); 132 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff);
120 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); 133 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff);
121 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10); 134 GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10);
122 135
123 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) 136 #define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X))
124 137
125 #endif 138 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698