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

Side by Side Diff: tests/DeferredCanvasTest.cpp

Issue 24130009: promote SkImage::AlphaType to SkAlphaType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/image/SkSurface_Picture.cpp ('k') | tests/DrawPathTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 static PixelPtr getSurfacePixelPtr(SkSurface* surface, bool useGpu) { 689 static PixelPtr getSurfacePixelPtr(SkSurface* surface, bool useGpu) {
690 return useGpu ? surface->getCanvas()->getDevice()->accessBitmap(false).getTe xture() : 690 return useGpu ? surface->getCanvas()->getDevice()->accessBitmap(false).getTe xture() :
691 surface->getCanvas()->getDevice()->accessBitmap(false).getPixels(); 691 surface->getCanvas()->getDevice()->accessBitmap(false).getPixels();
692 } 692 }
693 693
694 static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFac tory* factory) { 694 static void TestDeferredCanvasSurface(skiatest::Reporter* reporter, GrContextFac tory* factory) {
695 SkImage::Info imageSpec = { 695 SkImage::Info imageSpec = {
696 10, // width 696 10, // width
697 10, // height 697 10, // height
698 SkImage::kPMColor_ColorType, 698 SkImage::kPMColor_ColorType,
699 SkImage::kPremul_AlphaType 699 kPremul_SkAlphaType
700 }; 700 };
701 SkSurface* surface; 701 SkSurface* surface;
702 bool useGpu = NULL != factory; 702 bool useGpu = NULL != factory;
703 #if SK_SUPPORT_GPU 703 #if SK_SUPPORT_GPU
704 if (useGpu) { 704 if (useGpu) {
705 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e); 705 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e);
706 surface = SkSurface::NewRenderTarget(context, imageSpec); 706 surface = SkSurface::NewRenderTarget(context, imageSpec);
707 } else { 707 } else {
708 surface = SkSurface::NewRaster(imageSpec); 708 surface = SkSurface::NewRaster(imageSpec);
709 } 709 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 canvas->flush(); 756 canvas->flush();
757 PixelPtr pixels5 = getSurfacePixelPtr(surface, useGpu); 757 PixelPtr pixels5 = getSurfacePixelPtr(surface, useGpu);
758 REPORTER_ASSERT(reporter, pixels4 == pixels5); 758 REPORTER_ASSERT(reporter, pixels4 == pixels5);
759 } 759 }
760 760
761 static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContext Factory* factory) { 761 static void TestDeferredCanvasSetSurface(skiatest::Reporter* reporter, GrContext Factory* factory) {
762 SkImage::Info imageSpec = { 762 SkImage::Info imageSpec = {
763 10, // width 763 10, // width
764 10, // height 764 10, // height
765 SkImage::kPMColor_ColorType, 765 SkImage::kPMColor_ColorType,
766 SkImage::kPremul_AlphaType 766 kPremul_SkAlphaType
767 }; 767 };
768 SkSurface* surface; 768 SkSurface* surface;
769 SkSurface* alternateSurface; 769 SkSurface* alternateSurface;
770 bool useGpu = NULL != factory; 770 bool useGpu = NULL != factory;
771 #if SK_SUPPORT_GPU 771 #if SK_SUPPORT_GPU
772 if (useGpu) { 772 if (useGpu) {
773 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e); 773 GrContext* context = factory->get(GrContextFactory::kNative_GLContextTyp e);
774 surface = SkSurface::NewRenderTarget(context, imageSpec); 774 surface = SkSurface::NewRenderTarget(context, imageSpec);
775 alternateSurface = SkSurface::NewRenderTarget(context, imageSpec); 775 alternateSurface = SkSurface::NewRenderTarget(context, imageSpec);
776 } else { 776 } else {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 TestDeferredCanvasSurface(reporter, NULL); 839 TestDeferredCanvasSurface(reporter, NULL);
840 TestDeferredCanvasSetSurface(reporter, NULL); 840 TestDeferredCanvasSetSurface(reporter, NULL);
841 if (NULL != factory) { 841 if (NULL != factory) {
842 TestDeferredCanvasSurface(reporter, factory); 842 TestDeferredCanvasSurface(reporter, factory);
843 TestDeferredCanvasSetSurface(reporter, factory); 843 TestDeferredCanvasSetSurface(reporter, factory);
844 } 844 }
845 } 845 }
846 846
847 #include "TestClassDef.h" 847 #include "TestClassDef.h"
848 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva s) 848 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva s)
OLDNEW
« no previous file with comments | « src/image/SkSurface_Picture.cpp ('k') | tests/DrawPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698