| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 8 #include "SkGr.h" |
| 9 | 9 |
| 10 #include "GrXferProcessor.h" | 10 #include "GrXferProcessor.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 static GrTexture* create_texture_for_bmp(GrContext* ctx, | 173 static GrTexture* create_texture_for_bmp(GrContext* ctx, |
| 174 const GrUniqueKey& optionalKey, | 174 const GrUniqueKey& optionalKey, |
| 175 GrSurfaceDesc desc, | 175 GrSurfaceDesc desc, |
| 176 SkPixelRef* pixelRefForInvalidationNoti
fication, | 176 SkPixelRef* pixelRefForInvalidationNoti
fication, |
| 177 const void* pixels, | 177 const void* pixels, |
| 178 size_t rowBytes) { | 178 size_t rowBytes) { |
| 179 GrTexture* result = ctx->createTexture(desc, true, pixels, rowBytes); | 179 GrTexture* result = ctx->createTexture(desc, true, pixels, rowBytes); |
| 180 if (result && optionalKey.isValid()) { | 180 if (result && optionalKey.isValid()) { |
| 181 BitmapInvalidator* listener = SkNEW_ARGS(BitmapInvalidator, (optionalKey
)); | 181 BitmapInvalidator* listener = SkNEW_ARGS(BitmapInvalidator, (optionalKey
)); |
| 182 pixelRefForInvalidationNotification->addGenIDChangeListener(listener); | 182 pixelRefForInvalidationNotification->addGenIDChangeListener(listener); |
| 183 SkAssertResult(ctx->addResourceToCache(optionalKey, result)); | 183 ctx->addResourceToCache(optionalKey, result); |
| 184 } | 184 } |
| 185 return result; | 185 return result; |
| 186 } | 186 } |
| 187 | 187 |
| 188 // creates a new texture that is the input texture scaled up to the next power o
f two in | 188 // creates a new texture that is the input texture scaled up to the next power o
f two in |
| 189 // width or height. If optionalKey is valid it will be set on the new texture. s
tretch | 189 // width or height. If optionalKey is valid it will be set on the new texture. s
tretch |
| 190 // controls whether the scaling is done using nearest or bilerp filtering. | 190 // controls whether the scaling is done using nearest or bilerp filtering. |
| 191 GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch, | 191 GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch, |
| 192 SkPixelRef* pixelRef, | 192 SkPixelRef* pixelRef, |
| 193 const GrUniqueKey& optionalKey) { | 193 const GrUniqueKey& optionalKey) { |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { | 718 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { |
| 719 grPaint->addColorProcessor(fp)->unref(); | 719 grPaint->addColorProcessor(fp)->unref(); |
| 720 constantColor = false; | 720 constantColor = false; |
| 721 } | 721 } |
| 722 } | 722 } |
| 723 | 723 |
| 724 // The grcolor is automatically set when calling asFragmentProcessor. | 724 // The grcolor is automatically set when calling asFragmentProcessor. |
| 725 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 725 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
| 726 SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantColor, grP
aint); | 726 SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantColor, grP
aint); |
| 727 } | 727 } |
| OLD | NEW |