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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return g_supported_scales->back(); | 312 return g_supported_scales->back(); |
313 } | 313 } |
314 | 314 |
315 // static | 315 // static |
316 ImageSkia ImageSkia::CreateFrom1xBitmap(const SkBitmap& bitmap) { | 316 ImageSkia ImageSkia::CreateFrom1xBitmap(const SkBitmap& bitmap) { |
317 return ImageSkia(ImageSkiaRep(bitmap, 0.0f)); | 317 return ImageSkia(ImageSkiaRep(bitmap, 0.0f)); |
318 } | 318 } |
319 | 319 |
320 bool ImageSkia::IsDSFScalingInImageSkiaEnabled() { | 320 bool ImageSkia::IsDSFScalingInImageSkiaEnabled() { |
321 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 321 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
322 #if defined(OS_WIN) | |
323 return !command_line->HasSwitch( | 322 return !command_line->HasSwitch( |
324 switches::kDisallowArbitraryScaleFactorInImageSkia); | 323 switches::kDisableArbitraryScaleFactorInImageSkia); |
325 #else | |
326 return command_line->HasSwitch( | |
327 switches::kAllowArbitraryScaleFactorInImageSkia); | |
328 #endif | |
329 } | 324 } |
330 | 325 |
331 scoped_ptr<ImageSkia> ImageSkia::DeepCopy() const { | 326 scoped_ptr<ImageSkia> ImageSkia::DeepCopy() const { |
332 ImageSkia* copy = new ImageSkia; | 327 ImageSkia* copy = new ImageSkia; |
333 if (isNull()) | 328 if (isNull()) |
334 return scoped_ptr<ImageSkia>(copy); | 329 return scoped_ptr<ImageSkia>(copy); |
335 | 330 |
336 CHECK(CanRead()); | 331 CHECK(CanRead()); |
337 | 332 |
338 std::vector<gfx::ImageSkiaRep>& reps = storage_->image_reps(); | 333 std::vector<gfx::ImageSkiaRep>& reps = storage_->image_reps(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 bool ImageSkia::CanModify() const { | 498 bool ImageSkia::CanModify() const { |
504 return !storage_.get() || storage_->CanModify(); | 499 return !storage_.get() || storage_->CanModify(); |
505 } | 500 } |
506 | 501 |
507 void ImageSkia::DetachStorageFromThread() { | 502 void ImageSkia::DetachStorageFromThread() { |
508 if (storage_.get()) | 503 if (storage_.get()) |
509 storage_->DetachFromThread(); | 504 storage_->DetachFromThread(); |
510 } | 505 } |
511 | 506 |
512 } // namespace gfx | 507 } // namespace gfx |
OLD | NEW |