OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCRendererSoftware.h" | 7 #include "CCRendererSoftware.h" |
8 | 8 |
9 #include "CCQuadSink.h" | 9 #include "CCQuadSink.h" |
10 #include "CCRenderPass.h" | 10 #include "CCRenderPass.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 { | 105 { |
106 IntSize outerSize(100, 100); | 106 IntSize outerSize(100, 100); |
107 int outerPixels = outerSize.width() * outerSize.height(); | 107 int outerPixels = outerSize.width() * outerSize.height(); |
108 IntSize innerSize(98, 98); | 108 IntSize innerSize(98, 98); |
109 int innerPixels = innerSize.width() * innerSize.height(); | 109 int innerPixels = innerSize.width() * innerSize.height(); |
110 IntRect outerRect(IntPoint(), outerSize); | 110 IntRect outerRect(IntPoint(), outerSize); |
111 IntRect innerRect(IntPoint(1, 1), innerSize); | 111 IntRect innerRect(IntPoint(1, 1), innerSize); |
112 setViewportSize(outerSize); | 112 setViewportSize(outerSize); |
113 initializeRenderer(); | 113 initializeRenderer(); |
114 | 114 |
115 CCResourceProvider::ResourceId resourceYellow = resourceProvider()->createRe
source(1, outerSize, GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAn
y); | 115 CCResourceProvider::ResourceId resourceYellow = resourceProvider()->createRe
source(1, outerSize, GL_RGBA, CCResourceProvider::TextureUsageAny); |
116 CCResourceProvider::ResourceId resourceCyan = resourceProvider()->createReso
urce(1, innerSize, GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)
; | 116 CCResourceProvider::ResourceId resourceCyan = resourceProvider()->createReso
urce(1, innerSize, GL_RGBA, CCResourceProvider::TextureUsageAny); |
117 | 117 |
118 SkColor yellow = SK_ColorYELLOW; | 118 SkColor yellow = SK_ColorYELLOW; |
119 SkColor cyan = SK_ColorCYAN; | 119 SkColor cyan = SK_ColorCYAN; |
120 scoped_array<SkColor> yellowPixels(new SkColor[outerPixels]); | 120 scoped_array<SkColor> yellowPixels(new SkColor[outerPixels]); |
121 scoped_array<SkColor> cyanPixels(new SkColor[innerPixels]); | 121 scoped_array<SkColor> cyanPixels(new SkColor[innerPixels]); |
122 for (int i = 0; i < outerPixels; i++) | 122 for (int i = 0; i < outerPixels; i++) |
123 yellowPixels[i] = yellow; | 123 yellowPixels[i] = yellow; |
124 for (int i = 0; i < innerPixels; i++) | 124 for (int i = 0; i < innerPixels; i++) |
125 cyanPixels[i] = cyan; | 125 cyanPixels[i] = cyan; |
126 | 126 |
(...skipping 20 matching lines...) Expand all Loading... |
147 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi
ceViewportSize().height()]); | 147 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi
ceViewportSize().height()]); |
148 renderer()->getFramebufferPixels(pixels.get(), outerRect); | 148 renderer()->getFramebufferPixels(pixels.get(), outerRect); |
149 | 149 |
150 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); | 150 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); |
151 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); | 151 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); |
152 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); | 152 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); |
153 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); | 153 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); |
154 } | 154 } |
155 | 155 |
156 } // namespace | 156 } // namespace |
OLD | NEW |