Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / utility / cloud_print / bitmap_image.cc
blob5d43ee79bfe77345a9c528ecbaa066ea4125dde4
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
3 // found in the LICENSE file.
5 #include "base/logging.h"
6 #include "chrome/utility/cloud_print/bitmap_image.h"
8 namespace cloud_print {
10 namespace {
11 const uint8 kCurrentlySupportedNumberOfChannels = 4;
14 BitmapImage::BitmapImage(const gfx::Size& size,
15 Colorspace colorspace)
16 : size_(size),
17 colorspace_(colorspace),
18 data_(new uint8[size.GetArea() * channels()]) {
21 BitmapImage::~BitmapImage() {
24 uint8 BitmapImage::channels() const {
25 return kCurrentlySupportedNumberOfChannels;
28 const uint8* BitmapImage::GetPixel(const gfx::Point& point) const {
29 DCHECK_LT(point.x(), size_.width());
30 DCHECK_LT(point.y(), size_.height());
31 return data_.get() + (point.y() * size_.width() + point.x()) * channels();
34 } // namespace cloud_print