summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbase/gfx/bitmap_platform_device_mac.cc18
-rw-r--r--base/gfx/bitmap_platform_device_win.cc25
-rw-r--r--base/gfx/bitmap_platform_device_win.h10
-rw-r--r--base/gfx/platform_canvas_win.h19
-rw-r--r--base/gfx/vector_canvas.h8
-rw-r--r--base/gfx/vector_device.cc12
-rw-r--r--base/gfx/vector_device.h19
7 files changed, 32 insertions, 79 deletions
diff --git a/base/gfx/bitmap_platform_device_mac.cc b/base/gfx/bitmap_platform_device_mac.cc
index 24915d5..0bae190 100755
--- a/base/gfx/bitmap_platform_device_mac.cc
+++ b/base/gfx/bitmap_platform_device_mac.cc
@@ -67,18 +67,13 @@ class BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData
void SetTransform(const SkMatrix& t);
void SetClipRegion(const SkRegion& region);
- // Loads the current transform (taking into account offset_*_) and clip
- // into the DC. Can be called even when |bitmap_context_| is NULL (will be
- // a NOP).
+ // Loads the current transform and clip into the DC. Can be called even when
+ // |bitmap_context_| is NULL (will be a NOP).
void LoadConfig();
// Lazily-created graphics context used to draw into the bitmap.
CGContextRef bitmap_context_;
- // Additional offset applied to the transform. See setDeviceOffset().
- int offset_x_;
- int offset_y_;
-
// True when there is a transform or clip that has not been set to the
// CGContext. The CGContext is retrieved for every text operation, and the
// transform and clip do not change as much. We can save time by not loading
@@ -106,8 +101,6 @@ BitmapPlatformDeviceMac::\
BitmapPlatformDeviceMacData::BitmapPlatformDeviceMacData(
CGContextRef bitmap)
: bitmap_context_(bitmap),
- offset_x_(0),
- offset_y_(0),
config_dirty_(true) { // Want to load the config next time.
DCHECK(bitmap_context_);
// Initialize the clip region to the entire bitmap.
@@ -140,12 +133,10 @@ void BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData::LoadConfig() {
// Transform.
SkMatrix t(transform_);
- t.postTranslate(SkIntToScalar(-offset_x_), SkIntToScalar(-offset_y_));
LoadTransformToCGContext(bitmap_context_, t);
// TODO(brettw) we should support more than just rect clipping here.
SkIRect rect = clip_region_.getBounds();
- rect.offset(-offset_x_, -offset_y_);
CGContextClipToRect(bitmap_context_, SkIRectToCGRect(rect));
}
@@ -227,11 +218,6 @@ void BitmapPlatformDeviceMac::SetTransform(const SkMatrix& matrix) {
data_->SetTransform(matrix);
}
-void BitmapPlatformDeviceMac::SetDeviceOffset(int x, int y) {
- data_->offset_x_ = x;
- data_->offset_y_ = y;
-}
-
void BitmapPlatformDeviceMac::SetClipRegion(const SkRegion& region) {
data_->SetClipRegion(region);
}
diff --git a/base/gfx/bitmap_platform_device_win.cc b/base/gfx/bitmap_platform_device_win.cc
index e3ac799..1209db1 100644
--- a/base/gfx/bitmap_platform_device_win.cc
+++ b/base/gfx/bitmap_platform_device_win.cc
@@ -142,16 +142,14 @@ class BitmapPlatformDeviceWin::BitmapPlatformDeviceWinData
// but will mark the config as dirty. The next call of LoadConfig will
// pick up these changes.
void SetMatrixClip(const SkMatrix& transform, const SkRegion& region);
- // The device offset is already modified according to the transformation.
- void SetDeviceOffset(int x, int y);
const SkMatrix& transform() const {
return transform_;
}
protected:
- // Loads the current transform (taking into account offset_*_) and clip
- // into the DC. Can be called even when the DC is NULL (will be a NOP).
+ // Loads the current transform and clip into the DC. Can be called even when
+ // the DC is NULL (will be a NOP).
void LoadConfig();
// Windows bitmap corresponding to our surface.
@@ -160,10 +158,6 @@ class BitmapPlatformDeviceWin::BitmapPlatformDeviceWinData
// Lazily-created DC used to draw into the bitmap, see getBitmapDC.
HDC hdc_;
- // Additional offset applied to the transform. See setDeviceOffset().
- int offset_x_;
- int offset_y_;
-
// True when there is a transform or clip that has not been set to the DC.
// The DC is retrieved for every text operation, and the transform and clip
// do not change as much. We can save time by not loading the clip and
@@ -188,8 +182,6 @@ BitmapPlatformDeviceWin::BitmapPlatformDeviceWinData::BitmapPlatformDeviceWinDat
HBITMAP hbitmap)
: hbitmap_(hbitmap),
hdc_(NULL),
- offset_x_(0),
- offset_y_(0),
config_dirty_(true) { // Want to load the config next time.
// Initialize the clip region to the entire bitmap.
BITMAP bitmap_data;
@@ -244,13 +236,6 @@ void BitmapPlatformDeviceWin::BitmapPlatformDeviceWinData::SetMatrixClip(
config_dirty_ = true;
}
-void BitmapPlatformDeviceWin::BitmapPlatformDeviceWinData::SetDeviceOffset(int x,
- int y) {
- offset_x_ = x;
- offset_y_ = y;
- config_dirty_ = true;
-}
-
void BitmapPlatformDeviceWin::BitmapPlatformDeviceWinData::LoadConfig() {
if (!config_dirty_ || !hdc_)
return; // Nothing to do.
@@ -258,12 +243,10 @@ void BitmapPlatformDeviceWin::BitmapPlatformDeviceWinData::LoadConfig() {
// Transform.
SkMatrix t(transform_);
- t.postTranslate(SkIntToScalar(-offset_x_), SkIntToScalar(-offset_y_));
LoadTransformToDC(hdc_, t);
// We don't use transform_ for the clipping region since the translation is
// already applied to offset_x_ and offset_y_.
t.reset();
- t.postTranslate(SkIntToScalar(-offset_x_), SkIntToScalar(-offset_y_));
LoadClippingRegionToDC(hdc_, clip_region_, t);
}
@@ -357,10 +340,6 @@ void BitmapPlatformDeviceWin::setMatrixClip(const SkMatrix& transform,
data_->SetMatrixClip(transform, region);
}
-void BitmapPlatformDeviceWin::setDeviceOffset(int x, int y) {
- data_->SetDeviceOffset(x, y);
-}
-
void BitmapPlatformDeviceWin::drawToHDC(HDC dc, int x, int y,
const RECT* src_rect) {
bool created_dc = !data_->IsBitmapDCCreated();
diff --git a/base/gfx/bitmap_platform_device_win.h b/base/gfx/bitmap_platform_device_win.h
index cc3f9e8..fef7217 100644
--- a/base/gfx/bitmap_platform_device_win.h
+++ b/base/gfx/bitmap_platform_device_win.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_GFX_BITMAP_PLATFORM_DEVICE_WIN_H__
-#define BASE_GFX_BITMAP_PLATFORM_DEVICE_WIN_H__
+#ifndef BASE_GFX_BITMAP_PLATFORM_DEVICE_WIN_H_
+#define BASE_GFX_BITMAP_PLATFORM_DEVICE_WIN_H_
#include "base/gfx/platform_device_win.h"
#include "base/ref_counted.h"
@@ -60,7 +60,6 @@ class BitmapPlatformDeviceWin : public PlatformDeviceWin {
// bitmap DC is lazy created.
virtual HDC getBitmapDC();
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region);
- virtual void setDeviceOffset(int x, int y);
virtual void drawToHDC(HDC dc, int x, int y, const RECT* src_rect);
virtual void prepareForGDI(int x, int y, int width, int height);
@@ -90,7 +89,8 @@ class BitmapPlatformDeviceWin : public PlatformDeviceWin {
class BitmapPlatformDeviceWinData;
// Private constructor.
- BitmapPlatformDeviceWin(BitmapPlatformDeviceWinData* data, const SkBitmap& bitmap);
+ BitmapPlatformDeviceWin(BitmapPlatformDeviceWinData* data,
+ const SkBitmap& bitmap);
// Loops through each of the pixels in the specified range, invoking
// adjustor for the alpha value of each pixel. If |width| or |height| are -1,
@@ -107,5 +107,5 @@ class BitmapPlatformDeviceWin : public PlatformDeviceWin {
} // namespace gfx
-#endif // BASE_GFX_BITMAP_PLATFORM_DEVICE_WIN_H__
+#endif // BASE_GFX_BITMAP_PLATFORM_DEVICE_WIN_H_
diff --git a/base/gfx/platform_canvas_win.h b/base/gfx/platform_canvas_win.h
index 1e88970..20f9276 100644
--- a/base/gfx/platform_canvas_win.h
+++ b/base/gfx/platform_canvas_win.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_GFX_PLATFORM_CANVAS_WIN_H__
-#define BASE_GFX_PLATFORM_CANVAS_WIN_H__
+#ifndef BASE_GFX_PLATFORM_CANVAS_WIN_H_
+#define BASE_GFX_PLATFORM_CANVAS_WIN_H_
#include "base/gfx/platform_device_win.h"
#include "base/basictypes.h"
@@ -24,7 +24,8 @@ class PlatformCanvasWin : public SkCanvas {
// If you use the version with no arguments, you MUST call initialize()
PlatformCanvasWin();
PlatformCanvasWin(int width, int height, bool is_opaque);
- PlatformCanvasWin(int width, int height, bool is_opaque, HANDLE shared_section);
+ PlatformCanvasWin(int width, int height, bool is_opaque,
+ HANDLE shared_section);
virtual ~PlatformCanvasWin();
// For two-part init, call if you use the no-argument constructor above
@@ -60,7 +61,7 @@ class PlatformCanvasWin : public SkCanvas {
bool is_opaque, bool isForLayer);
// Creates a device store for use by the canvas. By default, it creates a
- // BitmapPlatformDeviceWin object. Can be overridden to change the object type.
+ // BitmapPlatformDeviceWin. Can be overridden to change the object type.
virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque,
HANDLE shared_section);
@@ -68,7 +69,7 @@ class PlatformCanvasWin : public SkCanvas {
// Unimplemented.
virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap);
- DISALLOW_EVIL_CONSTRUCTORS(PlatformCanvasWin);
+ DISALLOW_COPY_AND_ASSIGN(PlatformCanvasWin);
};
// A class designed to help with WM_PAINT operations on Windows. It will
@@ -160,8 +161,8 @@ class CanvasPaintT : public T {
void init(bool opaque) {
// FIXME(brettw) for ClearType, we probably want to expand the bounds of
// painting by one pixel so that the boundaries will be correct (ClearType
- // text can depend on the adjacent pixel). Then we would paint just the inset
- // pixels to the screen.
+ // text can depend on the adjacent pixel). Then we would paint just the
+ // inset pixels to the screen.
initialize(ps_.rcPaint.right - ps_.rcPaint.left,
ps_.rcPaint.bottom - ps_.rcPaint.top, opaque, NULL);
@@ -174,12 +175,12 @@ class CanvasPaintT : public T {
// If true, this canvas was created for a BeginPaint.
const bool for_paint_;
- DISALLOW_EVIL_CONSTRUCTORS(CanvasPaintT);
+ DISALLOW_COPY_AND_ASSIGN(CanvasPaintT);
};
typedef CanvasPaintT<PlatformCanvasWin> PlatformCanvasWinPaint;
} // namespace gfx
-#endif // BASE_GFX_PLATFORM_CANVAS_WIN_H__
+#endif // BASE_GFX_PLATFORM_CANVAS_WIN_H_
diff --git a/base/gfx/vector_canvas.h b/base/gfx/vector_canvas.h
index c8696a9..3d8b97e 100644
--- a/base/gfx/vector_canvas.h
+++ b/base/gfx/vector_canvas.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_GFX_VECTOR_CANVAS_H__
-#define BASE_GFX_VECTOR_CANVAS_H__
+#ifndef BASE_GFX_VECTOR_CANVAS_H_
+#define BASE_GFX_VECTOR_CANVAS_H_
#include "base/gfx/platform_canvas_win.h"
#include "base/gfx/vector_device.h"
@@ -37,10 +37,10 @@ class VectorCanvas : public PlatformCanvasWin {
// Returns true if the top device is vector based and not bitmap based.
bool IsTopDeviceVectorial() const;
- DISALLOW_EVIL_CONSTRUCTORS(VectorCanvas);
+ DISALLOW_COPY_AND_ASSIGN(VectorCanvas);
};
} // namespace gfx
-#endif // BASE_GFX_VECTOR_CANVAS_H__
+#endif // BASE_GFX_VECTOR_CANVAS_H_
diff --git a/base/gfx/vector_device.cc b/base/gfx/vector_device.cc
index 149dc20..8778299 100644
--- a/base/gfx/vector_device.cc
+++ b/base/gfx/vector_device.cc
@@ -50,9 +50,7 @@ VectorDevice::VectorDevice(HDC dc, const SkBitmap& bitmap)
: PlatformDeviceWin(bitmap),
hdc_(dc),
previous_brush_(NULL),
- previous_pen_(NULL),
- offset_x_(0),
- offset_y_(0) {
+ previous_pen_(NULL) {
transform_.reset();
}
@@ -342,21 +340,13 @@ void VectorDevice::setMatrixClip(const SkMatrix& transform,
LoadClipRegion();
}
-void VectorDevice::setDeviceOffset(int x, int y) {
- offset_x_ = x;
- offset_y_ = y;
-}
-
void VectorDevice::drawToHDC(HDC dc, int x, int y, const RECT* src_rect) {
NOTREACHED();
}
void VectorDevice::LoadClipRegion() {
- // We don't use transform_ for the clipping region since the translation is
- // already applied to offset_x_ and offset_y_.
SkMatrix t;
t.reset();
- t.postTranslate(SkIntToScalar(-offset_x_), SkIntToScalar(-offset_y_));
LoadClippingRegionToDC(hdc_, clip_region_, t);
}
diff --git a/base/gfx/vector_device.h b/base/gfx/vector_device.h
index 2d66d1a..5ebc558 100644
--- a/base/gfx/vector_device.h
+++ b/base/gfx/vector_device.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_GFX_VECTOR_DEVICE_H__
-#define BASE_GFX_VECTOR_DEVICE_H__
+#ifndef BASE_GFX_VECTOR_DEVICE_H_
+#define BASE_GFX_VECTOR_DEVICE_H_
#include "base/basictypes.h"
#include "base/gfx/platform_device_win.h"
@@ -29,8 +29,8 @@ class VectorDevice : public PlatformDeviceWin {
}
virtual void drawPaint(const SkDraw& draw, const SkPaint& paint);
- virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
- const SkPoint[], const SkPaint& paint);
+ virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
+ size_t count, const SkPoint[], const SkPaint& paint);
virtual void drawRect(const SkDraw& draw, const SkRect& r,
const SkPaint& paint);
virtual void drawPath(const SkDraw& draw, const SkPath& path,
@@ -47,7 +47,8 @@ class VectorDevice : public PlatformDeviceWin {
virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint);
- virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, int vertexCount,
+ virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode,
+ int vertexCount,
const SkPoint verts[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
@@ -57,7 +58,6 @@ class VectorDevice : public PlatformDeviceWin {
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region);
- virtual void setDeviceOffset(int x, int y);
virtual void drawToHDC(HDC dc, int x, int y, const RECT* src_rect);
virtual bool IsVectorial() { return true; }
@@ -110,13 +110,10 @@ class VectorDevice : public PlatformDeviceWin {
// Previously selected pen before the current drawing.
HGDIOBJ previous_pen_;
- int offset_x_;
- int offset_y_;
-
- DISALLOW_EVIL_CONSTRUCTORS(VectorDevice);
+ DISALLOW_COPY_AND_ASSIGN(VectorDevice);
};
} // namespace gfx
-#endif // BASE_GFX_VECTOR_DEVICE_H__
+#endif // BASE_GFX_VECTOR_DEVICE_H_