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

Side by Side Diff: tests/DeferredCanvasTest.cpp

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address initial comments Created 5 years, 11 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 2012 Google Inc. 2 * Copyright 2012 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 "../src/image/SkImagePriv.h" 8 #include "../src/image/SkImagePriv.h"
9 #include "../src/image/SkSurface_Base.h" 9 #include "../src/image/SkSurface_Base.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 if (useGpu) { 691 if (useGpu) {
692 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLCon textType) i; 692 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLCon textType) i;
693 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { 693 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
694 continue; 694 continue;
695 } 695 }
696 GrContext* context = factory->get(glCtxType); 696 GrContext* context = factory->get(glCtxType);
697 if (NULL == context) { 697 if (NULL == context) {
698 return; 698 return;
699 } 699 }
700 700
701 surface = SkSurface::NewRenderTarget(context, imageSpec, 0, NULL); 701 surface =
702 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, ima geSpec, 0, NULL);
702 } else 703 } else
703 #endif 704 #endif
704 { 705 {
705 surface = SkSurface::NewRaster(imageSpec); 706 surface = SkSurface::NewRaster(imageSpec);
706 } 707 }
707 SkASSERT(surface); 708 SkASSERT(surface);
708 SkAutoTUnref<SkSurface> aur(surface); 709 SkAutoTUnref<SkSurface> aur(surface);
709 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface)) ; 710 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(surface)) ;
710 711
711 SkImage* image1 = canvas->newImageSnapshot(); 712 SkImage* image1 = canvas->newImageSnapshot();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 #if SK_SUPPORT_GPU 774 #if SK_SUPPORT_GPU
774 if (useGpu) { 775 if (useGpu) {
775 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLCon textType) i; 776 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLCon textType) i;
776 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { 777 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
777 continue; 778 continue;
778 } 779 }
779 GrContext* context = factory->get(glCtxType); 780 GrContext* context = factory->get(glCtxType);
780 if (NULL == context) { 781 if (NULL == context) {
781 continue; 782 continue;
782 } 783 }
783 surface = SkSurface::NewRenderTarget(context, imageSpec, 0, NULL); 784 surface =
784 alternateSurface = SkSurface::NewRenderTarget(context, imageSpec, 0, NULL); 785 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, ima geSpec, 0, NULL);
786 alternateSurface =
787 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, ima geSpec, 0, NULL);
785 } else 788 } else
786 #endif 789 #endif
787 { 790 {
788 surface = SkSurface::NewRaster(imageSpec); 791 surface = SkSurface::NewRaster(imageSpec);
789 alternateSurface = SkSurface::NewRaster(imageSpec); 792 alternateSurface = SkSurface::NewRaster(imageSpec);
790 } 793 }
791 SkASSERT(surface); 794 SkASSERT(surface);
792 SkASSERT(alternateSurface); 795 SkASSERT(alternateSurface);
793 SkAutoTUnref<SkSurface> aur1(surface); 796 SkAutoTUnref<SkSurface> aur1(surface);
794 SkAutoTUnref<SkSurface> aur2(alternateSurface); 797 SkAutoTUnref<SkSurface> aur2(alternateSurface);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 TestDeferredCanvasSurface(reporter, NULL); 902 TestDeferredCanvasSurface(reporter, NULL);
900 TestDeferredCanvasSetSurface(reporter, NULL); 903 TestDeferredCanvasSetSurface(reporter, NULL);
901 } 904 }
902 905
903 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { 906 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) {
904 if (factory != NULL) { 907 if (factory != NULL) {
905 TestDeferredCanvasSurface(reporter, factory); 908 TestDeferredCanvasSurface(reporter, factory);
906 TestDeferredCanvasSetSurface(reporter, factory); 909 TestDeferredCanvasSetSurface(reporter, factory);
907 } 910 }
908 } 911 }
OLDNEW
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | tests/GpuDrawPathTest.cpp » ('j') | tests/SurfaceTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698