| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/resources/picture.h" | 5 #include "cc/resources/picture.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/test/fake_content_layer_client.h" | 10 #include "cc/test/fake_content_layer_client.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 TEST(PictureTest, PixelRefIterator) { | 103 TEST(PictureTest, PixelRefIterator) { |
| 104 gfx::Rect layer_rect(2048, 2048); | 104 gfx::Rect layer_rect(2048, 2048); |
| 105 | 105 |
| 106 SkTileGridPicture::TileGridInfo tile_grid_info; | 106 SkTileGridPicture::TileGridInfo tile_grid_info; |
| 107 tile_grid_info.fTileInterval = SkISize::Make(512, 512); | 107 tile_grid_info.fTileInterval = SkISize::Make(512, 512); |
| 108 tile_grid_info.fMargin.setEmpty(); | 108 tile_grid_info.fMargin.setEmpty(); |
| 109 tile_grid_info.fOffset.setZero(); | 109 tile_grid_info.fOffset.setZero(); |
| 110 | 110 |
| 111 FakeContentLayerClient content_layer_client; | 111 FakeContentLayerClient content_layer_client; |
| 112 | 112 |
| 113 // Lazy pixel refs are found in the following grids: | 113 // Discardable pixel refs are found in the following grids: |
| 114 // |---|---|---|---| | 114 // |---|---|---|---| |
| 115 // | | x | | x | | 115 // | | x | | x | |
| 116 // |---|---|---|---| | 116 // |---|---|---|---| |
| 117 // | x | | x | | | 117 // | x | | x | | |
| 118 // |---|---|---|---| | 118 // |---|---|---|---| |
| 119 // | | x | | x | | 119 // | | x | | x | |
| 120 // |---|---|---|---| | 120 // |---|---|---|---| |
| 121 // | x | | x | | | 121 // | x | | x | | |
| 122 // |---|---|---|---| | 122 // |---|---|---|---| |
| 123 SkBitmap lazy_bitmap[4][4]; | 123 SkBitmap discardable_bitmap[4][4]; |
| 124 for (int y = 0; y < 4; ++y) { | 124 for (int y = 0; y < 4; ++y) { |
| 125 for (int x = 0; x < 4; ++x) { | 125 for (int x = 0; x < 4; ++x) { |
| 126 if ((x + y) & 1) { | 126 if ((x + y) & 1) { |
| 127 CreateBitmap(gfx::Size(500, 500), "lazy", &lazy_bitmap[y][x]); | 127 CreateBitmap( |
| 128 gfx::Size(500, 500), "discardable", &discardable_bitmap[y][x]); |
| 128 SkPaint paint; | 129 SkPaint paint; |
| 129 content_layer_client.add_draw_bitmap( | 130 content_layer_client.add_draw_bitmap( |
| 130 lazy_bitmap[y][x], | 131 discardable_bitmap[y][x], |
| 131 gfx::Point(x * 512 + 6, y * 512 + 6), paint); | 132 gfx::Point(x * 512 + 6, y * 512 + 6), paint); |
| 132 } | 133 } |
| 133 } | 134 } |
| 134 } | 135 } |
| 135 | 136 |
| 136 scoped_refptr<Picture> picture = Picture::Create(layer_rect); | 137 scoped_refptr<Picture> picture = Picture::Create(layer_rect); |
| 137 picture->Record(&content_layer_client, | 138 picture->Record(&content_layer_client, |
| 138 tile_grid_info); | 139 tile_grid_info); |
| 139 picture->GatherPixelRefs(tile_grid_info); | 140 picture->GatherPixelRefs(tile_grid_info); |
| 140 | 141 |
| 141 // Default iterator does not have any pixel refs | 142 // Default iterator does not have any pixel refs |
| 142 { | 143 { |
| 143 Picture::PixelRefIterator iterator; | 144 Picture::PixelRefIterator iterator; |
| 144 EXPECT_FALSE(iterator); | 145 EXPECT_FALSE(iterator); |
| 145 } | 146 } |
| 146 for (int y = 0; y < 4; ++y) { | 147 for (int y = 0; y < 4; ++y) { |
| 147 for (int x = 0; x < 4; ++x) { | 148 for (int x = 0; x < 4; ++x) { |
| 148 Picture::PixelRefIterator iterator(gfx::Rect(x * 512, y * 512, 500, 500), | 149 Picture::PixelRefIterator iterator(gfx::Rect(x * 512, y * 512, 500, 500), |
| 149 picture.get()); | 150 picture.get()); |
| 150 if ((x + y) & 1) { | 151 if ((x + y) & 1) { |
| 151 EXPECT_TRUE(iterator) << x << " " << y; | 152 EXPECT_TRUE(iterator) << x << " " << y; |
| 152 EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef()) << x << " " << y; | 153 EXPECT_TRUE(*iterator == discardable_bitmap[y][x].pixelRef()) << x << |
| 154 " " << y; |
| 153 EXPECT_FALSE(++iterator) << x << " " << y; | 155 EXPECT_FALSE(++iterator) << x << " " << y; |
| 154 } else { | 156 } else { |
| 155 EXPECT_FALSE(iterator) << x << " " << y; | 157 EXPECT_FALSE(iterator) << x << " " << y; |
| 156 } | 158 } |
| 157 } | 159 } |
| 158 } | 160 } |
| 159 // Capture 4 pixel refs. | 161 // Capture 4 pixel refs. |
| 160 { | 162 { |
| 161 Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048), | 163 Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048), |
| 162 picture.get()); | 164 picture.get()); |
| 163 EXPECT_TRUE(iterator); | 165 EXPECT_TRUE(iterator); |
| 164 EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); | 166 EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef()); |
| 165 EXPECT_TRUE(++iterator); | 167 EXPECT_TRUE(++iterator); |
| 166 EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef()); | 168 EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef()); |
| 167 EXPECT_TRUE(++iterator); | 169 EXPECT_TRUE(++iterator); |
| 168 EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef()); | 170 EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef()); |
| 169 EXPECT_TRUE(++iterator); | 171 EXPECT_TRUE(++iterator); |
| 170 EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef()); | 172 EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef()); |
| 171 EXPECT_FALSE(++iterator); | 173 EXPECT_FALSE(++iterator); |
| 172 } | 174 } |
| 173 | 175 |
| 174 // Copy test. | 176 // Copy test. |
| 175 Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048), | 177 Picture::PixelRefIterator iterator(gfx::Rect(512, 512, 2048, 2048), |
| 176 picture.get()); | 178 picture.get()); |
| 177 EXPECT_TRUE(iterator); | 179 EXPECT_TRUE(iterator); |
| 178 EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); | 180 EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef()); |
| 179 EXPECT_TRUE(++iterator); | 181 EXPECT_TRUE(++iterator); |
| 180 EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef()); | 182 EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef()); |
| 181 | 183 |
| 182 // copy now points to the same spot as iterator, | 184 // copy now points to the same spot as iterator, |
| 183 // but both can be incremented independently. | 185 // but both can be incremented independently. |
| 184 Picture::PixelRefIterator copy = iterator; | 186 Picture::PixelRefIterator copy = iterator; |
| 185 EXPECT_TRUE(++iterator); | 187 EXPECT_TRUE(++iterator); |
| 186 EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef()); | 188 EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef()); |
| 187 EXPECT_TRUE(++iterator); | 189 EXPECT_TRUE(++iterator); |
| 188 EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef()); | 190 EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef()); |
| 189 EXPECT_FALSE(++iterator); | 191 EXPECT_FALSE(++iterator); |
| 190 | 192 |
| 191 EXPECT_TRUE(copy); | 193 EXPECT_TRUE(copy); |
| 192 EXPECT_TRUE(*copy == lazy_bitmap[2][1].pixelRef()); | 194 EXPECT_TRUE(*copy == discardable_bitmap[2][1].pixelRef()); |
| 193 EXPECT_TRUE(++copy); | 195 EXPECT_TRUE(++copy); |
| 194 EXPECT_TRUE(*copy == lazy_bitmap[2][3].pixelRef()); | 196 EXPECT_TRUE(*copy == discardable_bitmap[2][3].pixelRef()); |
| 195 EXPECT_TRUE(++copy); | 197 EXPECT_TRUE(++copy); |
| 196 EXPECT_TRUE(*copy == lazy_bitmap[3][2].pixelRef()); | 198 EXPECT_TRUE(*copy == discardable_bitmap[3][2].pixelRef()); |
| 197 EXPECT_FALSE(++copy); | 199 EXPECT_FALSE(++copy); |
| 198 } | 200 } |
| 199 | 201 |
| 200 TEST(PictureTest, PixelRefIteratorNonZeroLayer) { | 202 TEST(PictureTest, PixelRefIteratorNonZeroLayer) { |
| 201 gfx::Rect layer_rect(1024, 0, 2048, 2048); | 203 gfx::Rect layer_rect(1024, 0, 2048, 2048); |
| 202 | 204 |
| 203 SkTileGridPicture::TileGridInfo tile_grid_info; | 205 SkTileGridPicture::TileGridInfo tile_grid_info; |
| 204 tile_grid_info.fTileInterval = SkISize::Make(512, 512); | 206 tile_grid_info.fTileInterval = SkISize::Make(512, 512); |
| 205 tile_grid_info.fMargin.setEmpty(); | 207 tile_grid_info.fMargin.setEmpty(); |
| 206 tile_grid_info.fOffset.setZero(); | 208 tile_grid_info.fOffset.setZero(); |
| 207 | 209 |
| 208 FakeContentLayerClient content_layer_client; | 210 FakeContentLayerClient content_layer_client; |
| 209 | 211 |
| 210 // Lazy pixel refs are found in the following grids: | 212 // Discardable pixel refs are found in the following grids: |
| 211 // |---|---|---|---| | 213 // |---|---|---|---| |
| 212 // | | x | | x | | 214 // | | x | | x | |
| 213 // |---|---|---|---| | 215 // |---|---|---|---| |
| 214 // | x | | x | | | 216 // | x | | x | | |
| 215 // |---|---|---|---| | 217 // |---|---|---|---| |
| 216 // | | x | | x | | 218 // | | x | | x | |
| 217 // |---|---|---|---| | 219 // |---|---|---|---| |
| 218 // | x | | x | | | 220 // | x | | x | | |
| 219 // |---|---|---|---| | 221 // |---|---|---|---| |
| 220 SkBitmap lazy_bitmap[4][4]; | 222 SkBitmap discardable_bitmap[4][4]; |
| 221 for (int y = 0; y < 4; ++y) { | 223 for (int y = 0; y < 4; ++y) { |
| 222 for (int x = 0; x < 4; ++x) { | 224 for (int x = 0; x < 4; ++x) { |
| 223 if ((x + y) & 1) { | 225 if ((x + y) & 1) { |
| 224 CreateBitmap(gfx::Size(500, 500), "lazy", &lazy_bitmap[y][x]); | 226 CreateBitmap( |
| 227 gfx::Size(500, 500), "discardable", &discardable_bitmap[y][x]); |
| 225 SkPaint paint; | 228 SkPaint paint; |
| 226 content_layer_client.add_draw_bitmap( | 229 content_layer_client.add_draw_bitmap( |
| 227 lazy_bitmap[y][x], | 230 discardable_bitmap[y][x], |
| 228 gfx::Point(1024 + x * 512 + 6, y * 512 + 6), paint); | 231 gfx::Point(1024 + x * 512 + 6, y * 512 + 6), paint); |
| 229 } | 232 } |
| 230 } | 233 } |
| 231 } | 234 } |
| 232 | 235 |
| 233 scoped_refptr<Picture> picture = Picture::Create(layer_rect); | 236 scoped_refptr<Picture> picture = Picture::Create(layer_rect); |
| 234 picture->Record(&content_layer_client, | 237 picture->Record(&content_layer_client, |
| 235 tile_grid_info); | 238 tile_grid_info); |
| 236 picture->GatherPixelRefs(tile_grid_info); | 239 picture->GatherPixelRefs(tile_grid_info); |
| 237 | 240 |
| 238 // Default iterator does not have any pixel refs | 241 // Default iterator does not have any pixel refs |
| 239 { | 242 { |
| 240 Picture::PixelRefIterator iterator; | 243 Picture::PixelRefIterator iterator; |
| 241 EXPECT_FALSE(iterator); | 244 EXPECT_FALSE(iterator); |
| 242 } | 245 } |
| 243 for (int y = 0; y < 4; ++y) { | 246 for (int y = 0; y < 4; ++y) { |
| 244 for (int x = 0; x < 4; ++x) { | 247 for (int x = 0; x < 4; ++x) { |
| 245 Picture::PixelRefIterator iterator( | 248 Picture::PixelRefIterator iterator( |
| 246 gfx::Rect(1024 + x * 512, y * 512, 500, 500), picture.get()); | 249 gfx::Rect(1024 + x * 512, y * 512, 500, 500), picture.get()); |
| 247 if ((x + y) & 1) { | 250 if ((x + y) & 1) { |
| 248 EXPECT_TRUE(iterator) << x << " " << y; | 251 EXPECT_TRUE(iterator) << x << " " << y; |
| 249 EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef()); | 252 EXPECT_TRUE(*iterator == discardable_bitmap[y][x].pixelRef()); |
| 250 EXPECT_FALSE(++iterator) << x << " " << y; | 253 EXPECT_FALSE(++iterator) << x << " " << y; |
| 251 } else { | 254 } else { |
| 252 EXPECT_FALSE(iterator) << x << " " << y; | 255 EXPECT_FALSE(iterator) << x << " " << y; |
| 253 } | 256 } |
| 254 } | 257 } |
| 255 } | 258 } |
| 256 // Capture 4 pixel refs. | 259 // Capture 4 pixel refs. |
| 257 { | 260 { |
| 258 Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048), | 261 Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048), |
| 259 picture.get()); | 262 picture.get()); |
| 260 EXPECT_TRUE(iterator); | 263 EXPECT_TRUE(iterator); |
| 261 EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); | 264 EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef()); |
| 262 EXPECT_TRUE(++iterator); | 265 EXPECT_TRUE(++iterator); |
| 263 EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef()); | 266 EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef()); |
| 264 EXPECT_TRUE(++iterator); | 267 EXPECT_TRUE(++iterator); |
| 265 EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef()); | 268 EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef()); |
| 266 EXPECT_TRUE(++iterator); | 269 EXPECT_TRUE(++iterator); |
| 267 EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef()); | 270 EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef()); |
| 268 EXPECT_FALSE(++iterator); | 271 EXPECT_FALSE(++iterator); |
| 269 } | 272 } |
| 270 | 273 |
| 271 // Copy test. | 274 // Copy test. |
| 272 { | 275 { |
| 273 Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048), | 276 Picture::PixelRefIterator iterator(gfx::Rect(1024 + 512, 512, 2048, 2048), |
| 274 picture.get()); | 277 picture.get()); |
| 275 EXPECT_TRUE(iterator); | 278 EXPECT_TRUE(iterator); |
| 276 EXPECT_TRUE(*iterator == lazy_bitmap[1][2].pixelRef()); | 279 EXPECT_TRUE(*iterator == discardable_bitmap[1][2].pixelRef()); |
| 277 EXPECT_TRUE(++iterator); | 280 EXPECT_TRUE(++iterator); |
| 278 EXPECT_TRUE(*iterator == lazy_bitmap[2][1].pixelRef()); | 281 EXPECT_TRUE(*iterator == discardable_bitmap[2][1].pixelRef()); |
| 279 | 282 |
| 280 // copy now points to the same spot as iterator, | 283 // copy now points to the same spot as iterator, |
| 281 // but both can be incremented independently. | 284 // but both can be incremented independently. |
| 282 Picture::PixelRefIterator copy = iterator; | 285 Picture::PixelRefIterator copy = iterator; |
| 283 EXPECT_TRUE(++iterator); | 286 EXPECT_TRUE(++iterator); |
| 284 EXPECT_TRUE(*iterator == lazy_bitmap[2][3].pixelRef()); | 287 EXPECT_TRUE(*iterator == discardable_bitmap[2][3].pixelRef()); |
| 285 EXPECT_TRUE(++iterator); | 288 EXPECT_TRUE(++iterator); |
| 286 EXPECT_TRUE(*iterator == lazy_bitmap[3][2].pixelRef()); | 289 EXPECT_TRUE(*iterator == discardable_bitmap[3][2].pixelRef()); |
| 287 EXPECT_FALSE(++iterator); | 290 EXPECT_FALSE(++iterator); |
| 288 | 291 |
| 289 EXPECT_TRUE(copy); | 292 EXPECT_TRUE(copy); |
| 290 EXPECT_TRUE(*copy == lazy_bitmap[2][1].pixelRef()); | 293 EXPECT_TRUE(*copy == discardable_bitmap[2][1].pixelRef()); |
| 291 EXPECT_TRUE(++copy); | 294 EXPECT_TRUE(++copy); |
| 292 EXPECT_TRUE(*copy == lazy_bitmap[2][3].pixelRef()); | 295 EXPECT_TRUE(*copy == discardable_bitmap[2][3].pixelRef()); |
| 293 EXPECT_TRUE(++copy); | 296 EXPECT_TRUE(++copy); |
| 294 EXPECT_TRUE(*copy == lazy_bitmap[3][2].pixelRef()); | 297 EXPECT_TRUE(*copy == discardable_bitmap[3][2].pixelRef()); |
| 295 EXPECT_FALSE(++copy); | 298 EXPECT_FALSE(++copy); |
| 296 } | 299 } |
| 297 | 300 |
| 298 // Non intersecting rects | 301 // Non intersecting rects |
| 299 { | 302 { |
| 300 Picture::PixelRefIterator iterator(gfx::Rect(0, 0, 1000, 1000), | 303 Picture::PixelRefIterator iterator(gfx::Rect(0, 0, 1000, 1000), |
| 301 picture.get()); | 304 picture.get()); |
| 302 EXPECT_FALSE(iterator); | 305 EXPECT_FALSE(iterator); |
| 303 } | 306 } |
| 304 { | 307 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 321 TEST(PictureTest, PixelRefIteratorOnePixelQuery) { | 324 TEST(PictureTest, PixelRefIteratorOnePixelQuery) { |
| 322 gfx::Rect layer_rect(2048, 2048); | 325 gfx::Rect layer_rect(2048, 2048); |
| 323 | 326 |
| 324 SkTileGridPicture::TileGridInfo tile_grid_info; | 327 SkTileGridPicture::TileGridInfo tile_grid_info; |
| 325 tile_grid_info.fTileInterval = SkISize::Make(512, 512); | 328 tile_grid_info.fTileInterval = SkISize::Make(512, 512); |
| 326 tile_grid_info.fMargin.setEmpty(); | 329 tile_grid_info.fMargin.setEmpty(); |
| 327 tile_grid_info.fOffset.setZero(); | 330 tile_grid_info.fOffset.setZero(); |
| 328 | 331 |
| 329 FakeContentLayerClient content_layer_client; | 332 FakeContentLayerClient content_layer_client; |
| 330 | 333 |
| 331 // Lazy pixel refs are found in the following grids: | 334 // Discardable pixel refs are found in the following grids: |
| 332 // |---|---|---|---| | 335 // |---|---|---|---| |
| 333 // | | x | | x | | 336 // | | x | | x | |
| 334 // |---|---|---|---| | 337 // |---|---|---|---| |
| 335 // | x | | x | | | 338 // | x | | x | | |
| 336 // |---|---|---|---| | 339 // |---|---|---|---| |
| 337 // | | x | | x | | 340 // | | x | | x | |
| 338 // |---|---|---|---| | 341 // |---|---|---|---| |
| 339 // | x | | x | | | 342 // | x | | x | | |
| 340 // |---|---|---|---| | 343 // |---|---|---|---| |
| 341 SkBitmap lazy_bitmap[4][4]; | 344 SkBitmap discardable_bitmap[4][4]; |
| 342 for (int y = 0; y < 4; ++y) { | 345 for (int y = 0; y < 4; ++y) { |
| 343 for (int x = 0; x < 4; ++x) { | 346 for (int x = 0; x < 4; ++x) { |
| 344 if ((x + y) & 1) { | 347 if ((x + y) & 1) { |
| 345 CreateBitmap(gfx::Size(500, 500), "lazy", &lazy_bitmap[y][x]); | 348 CreateBitmap( |
| 349 gfx::Size(500, 500), "discardable", &discardable_bitmap[y][x]); |
| 346 SkPaint paint; | 350 SkPaint paint; |
| 347 content_layer_client.add_draw_bitmap( | 351 content_layer_client.add_draw_bitmap( |
| 348 lazy_bitmap[y][x], | 352 discardable_bitmap[y][x], |
| 349 gfx::Point(x * 512 + 6, y * 512 + 6), paint); | 353 gfx::Point(x * 512 + 6, y * 512 + 6), paint); |
| 350 } | 354 } |
| 351 } | 355 } |
| 352 } | 356 } |
| 353 | 357 |
| 354 scoped_refptr<Picture> picture = Picture::Create(layer_rect); | 358 scoped_refptr<Picture> picture = Picture::Create(layer_rect); |
| 355 picture->Record(&content_layer_client, | 359 picture->Record(&content_layer_client, |
| 356 tile_grid_info); | 360 tile_grid_info); |
| 357 picture->GatherPixelRefs(tile_grid_info); | 361 picture->GatherPixelRefs(tile_grid_info); |
| 358 | 362 |
| 359 for (int y = 0; y < 4; ++y) { | 363 for (int y = 0; y < 4; ++y) { |
| 360 for (int x = 0; x < 4; ++x) { | 364 for (int x = 0; x < 4; ++x) { |
| 361 Picture::PixelRefIterator iterator( | 365 Picture::PixelRefIterator iterator( |
| 362 gfx::Rect(x * 512, y * 512 + 256, 1, 1), picture.get()); | 366 gfx::Rect(x * 512, y * 512 + 256, 1, 1), picture.get()); |
| 363 if ((x + y) & 1) { | 367 if ((x + y) & 1) { |
| 364 EXPECT_TRUE(iterator) << x << " " << y; | 368 EXPECT_TRUE(iterator) << x << " " << y; |
| 365 EXPECT_TRUE(*iterator == lazy_bitmap[y][x].pixelRef()); | 369 EXPECT_TRUE(*iterator == discardable_bitmap[y][x].pixelRef()); |
| 366 EXPECT_FALSE(++iterator) << x << " " << y; | 370 EXPECT_FALSE(++iterator) << x << " " << y; |
| 367 } else { | 371 } else { |
| 368 EXPECT_FALSE(iterator) << x << " " << y; | 372 EXPECT_FALSE(iterator) << x << " " << y; |
| 369 } | 373 } |
| 370 } | 374 } |
| 371 } | 375 } |
| 372 } | 376 } |
| 373 | 377 |
| 374 TEST(PictureTest, CreateFromSkpValue) { | 378 TEST(PictureTest, CreateFromSkpValue) { |
| 375 SkGraphics::Init(); | 379 SkGraphics::Init(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 Picture::CreateFromSkpValue(skp_value); | 420 Picture::CreateFromSkpValue(skp_value); |
| 417 EXPECT_TRUE(!!one_rect_picture_check.get()); | 421 EXPECT_TRUE(!!one_rect_picture_check.get()); |
| 418 | 422 |
| 419 EXPECT_EQ(100, one_rect_picture_check->LayerRect().width()); | 423 EXPECT_EQ(100, one_rect_picture_check->LayerRect().width()); |
| 420 EXPECT_EQ(200, one_rect_picture_check->LayerRect().height()); | 424 EXPECT_EQ(200, one_rect_picture_check->LayerRect().height()); |
| 421 EXPECT_EQ(100, one_rect_picture_check->OpaqueRect().width()); | 425 EXPECT_EQ(100, one_rect_picture_check->OpaqueRect().width()); |
| 422 EXPECT_EQ(200, one_rect_picture_check->OpaqueRect().height()); | 426 EXPECT_EQ(200, one_rect_picture_check->OpaqueRect().height()); |
| 423 } | 427 } |
| 424 } // namespace | 428 } // namespace |
| 425 } // namespace cc | 429 } // namespace cc |
| OLD | NEW |