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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 years, 5 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
OLDNEW
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 "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // copies of texels from the original. 271 // copies of texels from the original.
272 GrTextureParams params(SkShader::kClamp_TileMode, 272 GrTextureParams params(SkShader::kClamp_TileMode,
273 Stretch::kBilerp_Type == stretch.fType ? 273 Stretch::kBilerp_Type == stretch.fType ?
274 GrTextureParams::kBilerp_FilterMode : 274 GrTextureParams::kBilerp_FilterMode :
275 GrTextureParams::kNone_FilterMode); 275 GrTextureParams::kNone_FilterMode);
276 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params); 276 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params);
277 277
278 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtD esc.fHeight)); 278 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtD esc.fHeight));
279 SkRect localRect = SkRect::MakeWH(1.f, 1.f); 279 SkRect localRect = SkRect::MakeWH(1.f, 1.f);
280 280
281 GrDrawContext* drawContext = context->drawContext(); 281 GrDrawContext* drawContext = context->drawContext(stretched->asRenderTarget( ));
282 if (!drawContext) { 282 if (!drawContext) {
283 return NULL; 283 return NULL;
284 } 284 }
285 drawContext->uses(inputTexture);
285 286
286 drawContext->drawNonAARectToRect(stretched->asRenderTarget(), GrClip::WideOp en(), paint, 287 drawContext->drawNonAARectToRect(stretched->asRenderTarget(), GrClip::WideOp en(), paint,
287 SkMatrix::I(), rect, localRect); 288 SkMatrix::I(), rect, localRect);
288 289
289 return stretched; 290 return stretched;
290 } 291 }
291 292
292 #ifndef SK_IGNORE_ETC1_SUPPORT 293 #ifndef SK_IGNORE_ETC1_SUPPORT
293 static GrTexture *load_etc1_texture(GrContext* ctx, const GrUniqueKey& optionalK ey, 294 static GrTexture *load_etc1_texture(GrContext* ctx, const GrUniqueKey& optionalK ey,
294 const SkBitmap &bm, GrSurfaceDesc desc) { 295 const SkBitmap &bm, GrSurfaceDesc desc) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 SkASSERT(renderTarget); 430 SkASSERT(renderTarget);
430 431
431 SkAutoTUnref<GrFragmentProcessor> 432 SkAutoTUnref<GrFragmentProcessor>
432 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(yuvTextures[0], yuvTextures[1 ], yuvTextures[2], 433 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(yuvTextures[0], yuvTextures[1 ], yuvTextures[2],
433 yuvInfo.fSize, yuvInfo.fColor Space)); 434 yuvInfo.fSize, yuvInfo.fColor Space));
434 GrPaint paint; 435 GrPaint paint;
435 paint.addColorProcessor(yuvToRgbProcessor); 436 paint.addColorProcessor(yuvToRgbProcessor);
436 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth), 437 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth),
437 SkIntToScalar(yuvInfo.fSize[0].fHeight)); 438 SkIntToScalar(yuvInfo.fSize[0].fHeight));
438 439
439 GrDrawContext* drawContext = ctx->drawContext(); 440 GrDrawContext* drawContext = ctx->drawContext(renderTarget);
440 if (!drawContext) { 441 if (!drawContext) {
441 return NULL; 442 return NULL;
442 } 443 }
444 drawContext->uses(yuvTextures[0]);
445 drawContext->uses(yuvTextures[1]);
446 drawContext->uses(yuvTextures[2]);
443 447
444 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I() , r); 448 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I() , r);
445 449
446 return result; 450 return result;
447 } 451 }
448 452
449 static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx, 453 static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx,
450 const SkBitmap& origBitmap, 454 const SkBitmap& origBitmap,
451 const GrUniqueKey& optionalK ey) { 455 const GrUniqueKey& optionalK ey) {
452 SkBitmap tmpBitmap; 456 SkBitmap tmpBitmap;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 802 }
799 return SkImageInfo::Make(w, h, ct, at); 803 return SkImageInfo::Make(w, h, ct, at);
800 } 804 }
801 805
802 806
803 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap * dst) { 807 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap * dst) {
804 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); 808 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque);
805 dst->setInfo(info); 809 dst->setInfo(info);
806 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); 810 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref();
807 } 811 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698