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

Side by Side Diff: cc/software_renderer_unittest.cc

Issue 11266030: Use gfx:: Geometry types for the resource provider and layer updater classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uint8 Created 8 years, 1 month 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 | « cc/skpicture_content_layer_updater.cc ('k') | cc/stubs/int_rect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/software_renderer.h" 7 #include "cc/software_renderer.h"
8 8
9 #include "cc/quad_sink.h" 9 #include "cc/quad_sink.h"
10 #include "cc/render_pass.h" 10 #include "cc/render_pass.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
127 resourceProvider()->upload(resourceYellow, reinterpret_cast<uint8_t*>(yellow Pixels.get()), IntRect(IntPoint(), outerSize), IntRect(IntPoint(), outerSize), I ntSize()); 127 resourceProvider()->upload(resourceYellow, reinterpret_cast<uint8_t*>(yellow Pixels.get()), gfx::Rect(gfx::Point(), outerSize), gfx::Rect(gfx::Point(), outer Size), gfx::Vector2d());
128 resourceProvider()->upload(resourceCyan, reinterpret_cast<uint8_t*>(cyanPixe ls.get()), IntRect(IntPoint(), innerSize), IntRect(IntPoint(), innerSize), IntSi ze()); 128 resourceProvider()->upload(resourceCyan, reinterpret_cast<uint8_t*>(cyanPixe ls.get()), gfx::Rect(gfx::Point(), innerSize), gfx::Rect(gfx::Point(), innerSize ), gfx::Vector2d());
129 129
130 IntRect rect = IntRect(IntPoint(), deviceViewportSize()); 130 IntRect rect = IntRect(IntPoint(), deviceViewportSize());
131 131
132 scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTra nsformationMatrix(), outerRect, outerRect, 1.0, true); 132 scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTra nsformationMatrix(), outerRect, outerRect, 1.0, true);
133 RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1); 133 RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1);
134 scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRende rPassId, IntRect(IntPoint(), deviceViewportSize()), WebTransformationMatrix()); 134 scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRende rPassId, IntRect(IntPoint(), deviceViewportSize()), WebTransformationMatrix());
135 scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, IntPoint(), outerSize, 0, false, false, f alse, false, false).PassAs<DrawQuad>(); 135 scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, IntPoint(), outerSize, 0, false, false, f alse, false, false).PassAs<DrawQuad>();
136 scoped_ptr<DrawQuad> innerQuad = TileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, IntPoint(), innerSize, 0, false, false, fal se, false, false).PassAs<DrawQuad>(); 136 scoped_ptr<DrawQuad> innerQuad = TileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, IntPoint(), innerSize, 0, false, false, fal se, false, false).PassAs<DrawQuad>();
137 rootRenderPass->appendQuad(innerQuad.Pass()); 137 rootRenderPass->appendQuad(innerQuad.Pass());
138 rootRenderPass->appendQuad(outerQuad.Pass()); 138 rootRenderPass->appendQuad(outerQuad.Pass());
139 139
140 RenderPassList list; 140 RenderPassList list;
141 RenderPassIdHashMap hashmap; 141 RenderPassIdHashMap hashmap;
142 list.push_back(rootRenderPass.get()); 142 list.push_back(rootRenderPass.get());
143 hashmap.add(rootRenderPassId, rootRenderPass.PassAs<RenderPass>()); 143 hashmap.add(rootRenderPassId, rootRenderPass.PassAs<RenderPass>());
144 renderer()->drawFrame(list, hashmap); 144 renderer()->drawFrame(list, hashmap);
145 145
146 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi ceViewportSize().height()]); 146 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi ceViewportSize().height()]);
147 renderer()->getFramebufferPixels(pixels.get(), outerRect); 147 renderer()->getFramebufferPixels(pixels.get(), outerRect);
148 148
149 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); 149 EXPECT_EQ(SK_ColorYELLOW, pixels[0]);
150 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); 150 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]);
151 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); 151 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]);
152 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); 152 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]);
153 } 153 }
154 154
155 } // namespace 155 } // namespace
OLDNEW
« no previous file with comments | « cc/skpicture_content_layer_updater.cc ('k') | cc/stubs/int_rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698