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 "cc/software_renderer.h" | 5 #include "cc/software_renderer.h" |
6 | 6 |
7 #include "cc/quad_sink.h" | 7 #include "cc/quad_sink.h" |
8 #include "cc/render_pass.h" | 8 #include "cc/render_pass.h" |
9 #include "cc/render_pass_draw_quad.h" | 9 #include "cc/render_pass_draw_quad.h" |
10 #include "cc/solid_color_draw_quad.h" | 10 #include "cc/solid_color_draw_quad.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 { | 103 { |
104 gfx::Size outerSize(100, 100); | 104 gfx::Size outerSize(100, 100); |
105 int outerPixels = outerSize.width() * outerSize.height(); | 105 int outerPixels = outerSize.width() * outerSize.height(); |
106 gfx::Size innerSize(98, 98); | 106 gfx::Size innerSize(98, 98); |
107 int innerPixels = innerSize.width() * innerSize.height(); | 107 int innerPixels = innerSize.width() * innerSize.height(); |
108 gfx::Rect outerRect(gfx::Point(), outerSize); | 108 gfx::Rect outerRect(gfx::Point(), outerSize); |
109 gfx::Rect innerRect(gfx::Point(1, 1), innerSize); | 109 gfx::Rect innerRect(gfx::Point(1, 1), innerSize); |
110 setViewportSize(outerSize); | 110 setViewportSize(outerSize); |
111 initializeRenderer(); | 111 initializeRenderer(); |
112 | 112 |
113 ResourceProvider::ResourceId resourceYellow = resourceProvider()->createReso
urce(1, outerSize, GL_RGBA, ResourceProvider::TextureUsageAny); | 113 ResourceProvider::ResourceId resourceYellow = resourceProvider()->createReso
urce(outerSize, GL_RGBA, ResourceProvider::TextureUsageAny); |
114 ResourceProvider::ResourceId resourceCyan = resourceProvider()->createResour
ce(1, innerSize, GL_RGBA, ResourceProvider::TextureUsageAny); | 114 ResourceProvider::ResourceId resourceCyan = resourceProvider()->createResour
ce(innerSize, GL_RGBA, ResourceProvider::TextureUsageAny); |
115 | 115 |
116 SkColor yellow = SK_ColorYELLOW; | 116 SkColor yellow = SK_ColorYELLOW; |
117 SkColor cyan = SK_ColorCYAN; | 117 SkColor cyan = SK_ColorCYAN; |
118 scoped_array<SkColor> yellowPixels(new SkColor[outerPixels]); | 118 scoped_array<SkColor> yellowPixels(new SkColor[outerPixels]); |
119 scoped_array<SkColor> cyanPixels(new SkColor[innerPixels]); | 119 scoped_array<SkColor> cyanPixels(new SkColor[innerPixels]); |
120 for (int i = 0; i < outerPixels; i++) | 120 for (int i = 0; i < outerPixels; i++) |
121 yellowPixels[i] = yellow; | 121 yellowPixels[i] = yellow; |
122 for (int i = 0; i < innerPixels; i++) | 122 for (int i = 0; i < innerPixels; i++) |
123 cyanPixels[i] = cyan; | 123 cyanPixels[i] = cyan; |
124 | 124 |
(...skipping 24 matching lines...) Expand all Loading... |
149 renderer()->getFramebufferPixels(pixels.get(), outerRect); | 149 renderer()->getFramebufferPixels(pixels.get(), outerRect); |
150 | 150 |
151 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); | 151 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); |
152 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); | 152 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); |
153 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); | 153 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); |
154 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); | 154 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); |
155 } | 155 } |
156 | 156 |
157 } // namespace | 157 } // namespace |
158 } // namespace cc | 158 } // namespace cc |
OLD | NEW |