| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/gfx/image/image_skia.h" | 5 #include "ui/gfx/image/image_skia.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 storage_->image_reps().push_back(image_rep); | 378 storage_->image_reps().push_back(image_rep); |
| 379 } | 379 } |
| 380 | 380 |
| 381 SkBitmap& ImageSkia::GetBitmap() const { | 381 SkBitmap& ImageSkia::GetBitmap() const { |
| 382 if (isNull()) { | 382 if (isNull()) { |
| 383 // Callers expect a ImageSkiaRep even if it is |isNull()|. | 383 // Callers expect a ImageSkiaRep even if it is |isNull()|. |
| 384 // TODO(pkotwicz): Fix this. | 384 // TODO(pkotwicz): Fix this. |
| 385 return NullImageRep().mutable_sk_bitmap(); | 385 return NullImageRep().mutable_sk_bitmap(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 // TODO(oshima): This made a few tests flaky on Windows. |
| 389 // Fix the root cause and re-enable this. crbug.com/145623. |
| 390 #if !defined(OS_WIN) |
| 388 CHECK(CanRead()); | 391 CHECK(CanRead()); |
| 392 #endif |
| 389 | 393 |
| 390 ImageSkiaReps::iterator it = | 394 ImageSkiaReps::iterator it = |
| 391 storage_->FindRepresentation(ui::SCALE_FACTOR_100P, true); | 395 storage_->FindRepresentation(ui::SCALE_FACTOR_100P, true); |
| 392 if (it != storage_->image_reps().end()) | 396 if (it != storage_->image_reps().end()) |
| 393 return it->mutable_sk_bitmap(); | 397 return it->mutable_sk_bitmap(); |
| 394 return NullImageRep().mutable_sk_bitmap(); | 398 return NullImageRep().mutable_sk_bitmap(); |
| 395 } | 399 } |
| 396 | 400 |
| 397 bool ImageSkia::CanRead() const { | 401 bool ImageSkia::CanRead() const { |
| 398 return !storage_ || storage_->CanRead(); | 402 return !storage_ || storage_->CanRead(); |
| 399 } | 403 } |
| 400 | 404 |
| 401 bool ImageSkia::CanModify() const { | 405 bool ImageSkia::CanModify() const { |
| 402 return !storage_ || storage_->CanModify(); | 406 return !storage_ || storage_->CanModify(); |
| 403 } | 407 } |
| 404 | 408 |
| 405 void ImageSkia::DetachStorageFromThread() { | 409 void ImageSkia::DetachStorageFromThread() { |
| 406 if (storage_) | 410 if (storage_) |
| 407 storage_->DetachFromThread(); | 411 storage_->DetachFromThread(); |
| 408 } | 412 } |
| 409 | 413 |
| 410 } // namespace gfx | 414 } // namespace gfx |
| OLD | NEW |