OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/skbitmap_operations.h" | 5 #include "ui/gfx/skbitmap_operations.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 (*line_proc)(hsl_shift, pixels, tinted_pixels, bitmap.width()); | 567 (*line_proc)(hsl_shift, pixels, tinted_pixels, bitmap.width()); |
568 } | 568 } |
569 | 569 |
570 return shifted; | 570 return shifted; |
571 } | 571 } |
572 | 572 |
573 // static | 573 // static |
574 SkBitmap SkBitmapOperations::CreateTiledBitmap(const SkBitmap& source, | 574 SkBitmap SkBitmapOperations::CreateTiledBitmap(const SkBitmap& source, |
575 int src_x, int src_y, | 575 int src_x, int src_y, |
576 int dst_w, int dst_h) { | 576 int dst_w, int dst_h) { |
577 DCHECK(source.getConfig() == SkBitmap::kARGB_8888_Config); | 577 DCHECK(source.config() == SkBitmap::kARGB_8888_Config); |
578 | 578 |
579 SkBitmap cropped; | 579 SkBitmap cropped; |
580 cropped.setConfig(SkBitmap::kARGB_8888_Config, dst_w, dst_h, 0); | 580 cropped.setConfig(SkBitmap::kARGB_8888_Config, dst_w, dst_h, 0); |
581 cropped.allocPixels(); | 581 cropped.allocPixels(); |
582 cropped.eraseARGB(0, 0, 0, 0); | 582 cropped.eraseARGB(0, 0, 0, 0); |
583 | 583 |
584 SkAutoLockPixels lock_source(source); | 584 SkAutoLockPixels lock_source(source); |
585 SkAutoLockPixels lock_cropped(cropped); | 585 SkAutoLockPixels lock_cropped(cropped); |
586 | 586 |
587 // Loop through the pixels of the original bitmap. | 587 // Loop through the pixels of the original bitmap. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 uint32* image_row = image.getAddr32(0, y); | 731 uint32* image_row = image.getAddr32(0, y); |
732 for (int x = 0; x < image.width(); ++x) { | 732 for (int x = 0; x < image.width(); ++x) { |
733 uint32* dst = transposed.getAddr32(y, x); | 733 uint32* dst = transposed.getAddr32(y, x); |
734 *dst = image_row[x]; | 734 *dst = image_row[x]; |
735 } | 735 } |
736 } | 736 } |
737 | 737 |
738 return transposed; | 738 return transposed; |
739 } | 739 } |
740 | 740 |
OLD | NEW |