OLD | NEW |
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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkImage.h" | 10 #include "SkImage.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 static void draw_as_bitmap(SkCanvas* canvas, SkImageCacherator* cache, SkSca
lar x, SkScalar y) { | 309 static void draw_as_bitmap(SkCanvas* canvas, SkImageCacherator* cache, SkSca
lar x, SkScalar y) { |
310 SkBitmap bitmap; | 310 SkBitmap bitmap; |
311 cache->lockAsBitmap(&bitmap, nullptr); | 311 cache->lockAsBitmap(&bitmap, nullptr); |
312 canvas->drawBitmap(bitmap, x, y); | 312 canvas->drawBitmap(bitmap, x, y); |
313 } | 313 } |
314 | 314 |
315 static void draw_as_tex(SkCanvas* canvas, SkImageCacherator* cache, SkScalar
x, SkScalar y) { | 315 static void draw_as_tex(SkCanvas* canvas, SkImageCacherator* cache, SkScalar
x, SkScalar y) { |
316 #if SK_SUPPORT_GPU | 316 #if SK_SUPPORT_GPU |
317 SkAutoTUnref<GrTexture> texture(cache->lockAsTexture(canvas->getGrContex
t(), | 317 SkAutoTUnref<GrTexture> texture(cache->lockAsTexture(canvas->getGrContex
t(), |
318 GrTextureParams::Cl
ampBilerp(), | 318 GrTextureParams::Cl
ampBilerp(), |
| 319 SkSourceGammaTreatm
ent::kRespect, |
319 nullptr)); | 320 nullptr)); |
320 if (!texture) { | 321 if (!texture) { |
321 // show placeholder if we have no texture | 322 // show placeholder if we have no texture |
322 SkPaint paint; | 323 SkPaint paint; |
323 paint.setStyle(SkPaint::kStroke_Style); | 324 paint.setStyle(SkPaint::kStroke_Style); |
324 SkRect r = SkRect::MakeXYWH(x, y, SkIntToScalar(cache->info().width(
)), | 325 SkRect r = SkRect::MakeXYWH(x, y, SkIntToScalar(cache->info().width(
)), |
325 SkIntToScalar(cache->info().width())); | 326 SkIntToScalar(cache->info().width())); |
326 canvas->drawRect(r, paint); | 327 canvas->drawRect(r, paint); |
327 canvas->drawLine(r.left(), r.top(), r.right(), r.bottom(), paint); | 328 canvas->drawLine(r.left(), r.top(), r.right(), r.bottom(), paint); |
328 canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint); | 329 canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 373 |
373 private: | 374 private: |
374 typedef skiagm::GM INHERITED; | 375 typedef skiagm::GM INHERITED; |
375 }; | 376 }; |
376 DEF_GM( return new ImageCacheratorGM("picture", make_pic_generator); ) | 377 DEF_GM( return new ImageCacheratorGM("picture", make_pic_generator); ) |
377 DEF_GM( return new ImageCacheratorGM("raster", make_ras_generator); ) | 378 DEF_GM( return new ImageCacheratorGM("raster", make_ras_generator); ) |
378 DEF_GM( return new ImageCacheratorGM("ctable", make_ctable_generator); ) | 379 DEF_GM( return new ImageCacheratorGM("ctable", make_ctable_generator); ) |
379 #if SK_SUPPORT_GPU | 380 #if SK_SUPPORT_GPU |
380 DEF_GM( return new ImageCacheratorGM("texture", make_tex_generator); ) | 381 DEF_GM( return new ImageCacheratorGM("texture", make_tex_generator); ) |
381 #endif | 382 #endif |
OLD | NEW |