OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 if (surfaceType == kGpu_SurfaceType || surfaceType == kGpuScratch_SurfaceTyp
e) { | 449 if (surfaceType == kGpu_SurfaceType || surfaceType == kGpuScratch_SurfaceTyp
e) { |
450 REPORTER_ASSERT(reporter, texture); | 450 REPORTER_ASSERT(reporter, texture); |
451 REPORTER_ASSERT(reporter, 0 != texture->getTextureHandle()); | 451 REPORTER_ASSERT(reporter, 0 != texture->getTextureHandle()); |
452 } else { | 452 } else { |
453 REPORTER_ASSERT(reporter, NULL == texture); | 453 REPORTER_ASSERT(reporter, NULL == texture); |
454 } | 454 } |
455 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode); | 455 surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode); |
456 REPORTER_ASSERT(reporter, image->getTexture() == texture); | 456 REPORTER_ASSERT(reporter, image->getTexture() == texture); |
457 } | 457 } |
458 | 458 |
459 #include "GrGpuResourceCacheAccess.h" | 459 #include "GrGpuResourcePriv.h" |
460 #include "SkGpuDevice.h" | 460 #include "SkGpuDevice.h" |
461 #include "SkImage_Gpu.h" | 461 #include "SkImage_Gpu.h" |
462 #include "SkSurface_Gpu.h" | 462 #include "SkSurface_Gpu.h" |
463 | 463 |
464 SkSurface::Budgeted is_budgeted(SkSurface* surf) { | 464 SkSurface::Budgeted is_budgeted(SkSurface* surf) { |
465 return ((SkSurface_Gpu*)surf)->getDevice()->accessRenderTarget()->cacheAcces
s().isBudgeted() ? | 465 return ((SkSurface_Gpu*)surf)->getDevice()->accessRenderTarget()->resourcePr
iv().isBudgeted() ? |
466 SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted; | 466 SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted; |
467 } | 467 } |
468 | 468 |
469 SkSurface::Budgeted is_budgeted(SkImage* image) { | 469 SkSurface::Budgeted is_budgeted(SkImage* image) { |
470 return ((SkImage_Gpu*)image)->getTexture()->cacheAccess().isBudgeted() ? | 470 return ((SkImage_Gpu*)image)->getTexture()->resourcePriv().isBudgeted() ? |
471 SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted; | 471 SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted; |
472 } | 472 } |
473 | 473 |
474 static void test_surface_budget(skiatest::Reporter* reporter, GrContext* context
) { | 474 static void test_surface_budget(skiatest::Reporter* reporter, GrContext* context
) { |
475 SkImageInfo info = SkImageInfo::MakeN32Premul(8,8); | 475 SkImageInfo info = SkImageInfo::MakeN32Premul(8,8); |
476 for (int i = 0; i < 2; ++i) { | 476 for (int i = 0; i < 2; ++i) { |
477 SkSurface::Budgeted sbudgeted = i ? SkSurface::kYes_Budgeted : SkSurface
::kNo_Budgeted; | 477 SkSurface::Budgeted sbudgeted = i ? SkSurface::kYes_Budgeted : SkSurface
::kNo_Budgeted; |
478 for (int j = 0; j < 2; ++j) { | 478 for (int j = 0; j < 2; ++j) { |
479 SkSurface::Budgeted ibudgeted = j ? SkSurface::kYes_Budgeted : SkSur
face::kNo_Budgeted; | 479 SkSurface::Budgeted ibudgeted = j ? SkSurface::kYes_Budgeted : SkSur
face::kNo_Budgeted; |
480 SkAutoTUnref<SkSurface> | 480 SkAutoTUnref<SkSurface> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); | 570 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); |
571 TestGetTexture(reporter, kGpu_SurfaceType, context); | 571 TestGetTexture(reporter, kGpu_SurfaceType, context); |
572 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); | 572 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); |
573 test_empty_surface(reporter, context); | 573 test_empty_surface(reporter, context); |
574 test_surface_budget(reporter, context); | 574 test_surface_budget(reporter, context); |
575 } | 575 } |
576 } | 576 } |
577 } | 577 } |
578 #endif | 578 #endif |
579 } | 579 } |
OLD | NEW |