diff --git a/gyp/core.gypi b/gyp/core.gypi
index 9e416ac..2c3f4d4 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -15,6 +15,8 @@
         '<(skia_src_path)/core/SkAlphaRuns.cpp',
         '<(skia_src_path)/core/SkAntiRun.h',
         '<(skia_src_path)/core/SkBBoxHierarchy.h',
+        '<(skia_src_path)/core/SkBBoxRecord.cpp',
+        '<(skia_src_path)/core/SkBBoxRecord.h',
         '<(skia_src_path)/core/SkBitmap.cpp',
         '<(skia_src_path)/core/SkBitmapHeap.cpp',
         '<(skia_src_path)/core/SkBitmapHeap.h',
diff --git a/src/core/SkBBoxRecord.cpp b/src/core/SkBBoxRecord.cpp
new file mode 100644
index 0000000..04661d0
--- /dev/null
+++ b/src/core/SkBBoxRecord.cpp
@@ -0,0 +1,253 @@
+
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBBoxRecord.h"
+
+void SkBBoxRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
+    if (this->transformBounds(rect, &paint)) {
+        INHERITED::drawRect(rect, paint);
+    }
+}
+
+void SkBBoxRecord::drawPath(const SkPath& path, const SkPaint& paint) {
+    if (this->transformBounds(path.getBounds(), &paint)) {
+        INHERITED::drawPath(path, paint);
+    }
+}
+
+void SkBBoxRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
+                              const SkPaint& paint) {
+    SkRect bbox;
+    bbox.set(pts, count);
+    if (this->transformBounds(bbox, &paint)) {
+        INHERITED::drawPoints(mode, count, pts, paint);
+    }
+} 
+
+void SkBBoxRecord::drawPaint(const SkPaint& paint) {
+    SkRect bbox;
+    if (this->getClipBounds(&bbox)) {
+        if (this->transformBounds(bbox, &paint)) {
+            INHERITED::drawPaint(paint);
+        }
+    }
+}
+
+void SkBBoxRecord::clear(SkColor color) {
+    SkISize size = this->getDeviceSize();
+    SkRect bbox = {0, 0, size.width(), size.height()};
+    this->handleBBox(bbox);
+    INHERITED::clear(color);
+}
+
+void SkBBoxRecord::drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, 
+                            const SkPaint& paint) {
+    SkRect bbox;
+    paint.measureText(text, byteLength, &bbox);
+    SkPaint::FontMetrics metrics;
+    paint.getFontMetrics(&metrics);
+
+    // Vertical and aligned text need to be offset
+    if (paint.isVerticalText()) {
+        SkScalar h = bbox.fBottom - bbox.fTop;
+        if (paint.getTextAlign() == SkPaint::kCenter_Align) {
+            bbox.fTop    -= h / 2;
+            bbox.fBottom -= h / 2;
+        }
+        // Pad top and bottom with max extents from FontMetrics
+        bbox.fBottom += metrics.fBottom;
+        bbox.fTop += metrics.fTop;
+    } else {
+        SkScalar w = bbox.fRight - bbox.fLeft;
+        if (paint.getTextAlign() == SkPaint::kCenter_Align) {
+            bbox.fLeft  -= w / 2;
+            bbox.fRight -= w / 2;
+        } else if (paint.getTextAlign() == SkPaint::kRight_Align) {
+            bbox.fLeft  -= w;
+            bbox.fRight -= w;
+        }
+        // Set vertical bounds to max extents from font metrics
+        bbox.fTop = metrics.fTop;
+        bbox.fBottom = metrics.fBottom;
+    }
+
+    // Pad horizontal bounds on each side by half of max vertical extents (this is sort of 
+    // arbitrary, but seems to produce reasonable results, if there were a way of getting max
+    // glyph X-extents to pad by, that may be better here, but FontMetrics fXMin and fXMax seem
+    // incorrect on most platforms (too small in Linux, never even set in Windows).
+    SkScalar pad = (metrics.fBottom - metrics.fTop) / 2;
+    bbox.fLeft  -= pad;
+    bbox.fRight += pad;
+
+    bbox.fLeft += x;
+    bbox.fRight += x;
+    bbox.fTop += y;
+    bbox.fBottom += y;
+    if (this->transformBounds(bbox, &paint)) {
+        INHERITED::drawText(text, byteLength, x, y, paint);
+    }
+}
+
+void SkBBoxRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
+                              const SkPaint* paint) {
+    SkRect bbox = {left, top, left + bitmap.width(), top + bitmap.height()};
+    if (this->transformBounds(bbox, paint)) {
+        INHERITED::drawBitmap(bitmap, left, top, paint);
+    }
+}
+
+void SkBBoxRecord::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
+                                  const SkRect& dst, const SkPaint* paint) {
+    if (this->transformBounds(dst, paint)) {
+        INHERITED::drawBitmapRect(bitmap, src, dst, paint);
+    }
+}
+
+void SkBBoxRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& mat,
+                                    const SkPaint* paint) {
+    SkMatrix m = mat;
+    SkRect bbox = {0, 0, bitmap.width(), bitmap.height()};
+    m.mapRect(&bbox);
+    if (this->transformBounds(bbox, paint)) {
+        INHERITED::drawBitmapMatrix(bitmap, mat, paint);
+    }
+}
+
+void SkBBoxRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+                                  const SkRect& dst, const SkPaint* paint) {
+    if (this->transformBounds(dst, paint)) {
+        INHERITED::drawBitmapNine(bitmap, center, dst, paint);
+    }
+}
+
+void SkBBoxRecord::drawPosText(const void* text, size_t byteLength,
+                               const SkPoint pos[], const SkPaint& paint) {
+    SkRect bbox;
+    bbox.set(pos, paint.countText(text, byteLength));
+    SkPaint::FontMetrics metrics;
+    paint.getFontMetrics(&metrics);
+    bbox.fTop += metrics.fTop;
+    bbox.fBottom += metrics.fBottom;
+
+    // pad on left and right by half of max vertical glyph extents
+    SkScalar pad = (metrics.fTop - metrics.fBottom) / 2;
+    bbox.fLeft += pad;
+    bbox.fRight -= pad;
+
+    if (this->transformBounds(bbox, &paint)) {
+        INHERITED::drawPosText(text, byteLength, pos, paint);
+    }
+}
+
+void SkBBoxRecord::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
+                                SkScalar constY, const SkPaint& paint) {
+    SkRect bbox;
+    size_t numChars = paint.countText(text, byteLength);
+    if (numChars > 0) {
+        bbox.fLeft  = xpos[0];
+        bbox.fRight = xpos[numChars - 1];
+        // if we had a guarantee that these will be monotonically increasing, this could be sped up
+        for (size_t i = 1; i < numChars; ++i) {
+            if (xpos[i] < bbox.fLeft) {
+                bbox.fLeft = xpos[i];
+            }
+            if (xpos[i] > bbox.fRight) {
+                bbox.fRight = xpos[i];
+            }
+        }
+        SkPaint::FontMetrics metrics;
+        paint.getFontMetrics(&metrics);
+
+        // pad horizontally by half max glyph height
+        SkScalar pad = (metrics.fTop - metrics.fBottom) / 2;
+        bbox.fLeft  += pad;
+        bbox.fRight -= pad;
+
+        bbox.fTop    = metrics.fTop + constY;
+        bbox.fBottom = metrics.fBottom + constY;
+        if (!this->transformBounds(bbox, &paint)) {
+            return;
+        }
+    }
+    INHERITED::drawPosTextH(text, byteLength, xpos, constY, paint);
+}
+
+void SkBBoxRecord::drawSprite(const SkBitmap& bitmap, int left, int top,
+                              const SkPaint* paint) {
+    SkRect bbox = {left, top, left + bitmap.width(), top + bitmap.height()};
+    this->handleBBox(bbox); // directly call handleBBox, matrix is ignored
+    INHERITED::drawBitmap(bitmap, left, top, paint);
+}
+
+void SkBBoxRecord::drawTextOnPath(const void* text, size_t byteLength,
+                                  const SkPath& path, const SkMatrix* matrix,
+                                  const SkPaint& paint) {
+    SkRect bbox = path.getBounds();
+    SkPaint::FontMetrics metrics;
+    paint.getFontMetrics(&metrics);
+
+    // pad out all sides by the max glyph height above baseline
+    SkScalar pad = metrics.fTop;
+    bbox.fLeft += pad;
+    bbox.fRight -= pad;
+    bbox.fTop += pad;
+    bbox.fBottom -= pad;
+
+    if (this->transformBounds(bbox, &paint)) {
+        INHERITED::drawTextOnPath(text, byteLength, path, matrix, paint);
+    }
+}
+
+void SkBBoxRecord::drawVertices(VertexMode mode, int vertexCount,
+                                const SkPoint vertices[], const SkPoint texs[],
+                                const SkColor colors[], SkXfermode* xfer,
+                                const uint16_t indices[], int indexCount,
+                                const SkPaint& paint) {
+    SkRect bbox;
+    bbox.set(vertices, vertexCount);
+    if (this->transformBounds(bbox, &paint)) {
+        INHERITED::drawVertices(mode, vertexCount, vertices, texs,
+                                colors, xfer, indices, indexCount, paint);
+    }
+}
+
+void SkBBoxRecord::drawPicture(SkPicture& picture) {
+    SkRect bbox = {0, 0, picture.width(), picture.height()};
+    if (this->transformBounds(bbox, NULL)) {
+        INHERITED::drawPicture(picture);
+    }
+}
+
+bool SkBBoxRecord::transformBounds(const SkRect& bounds, const SkPaint* paint) {
+    SkRect outBounds = bounds;
+
+    if (paint) {
+        // account for stroking, path effects, shadows, etc
+        if (paint->canComputeFastBounds()) {
+            SkRect temp;
+            outBounds = paint->computeFastBounds(bounds, &temp);
+        } else {
+            // set bounds to current clip
+            if (!this->getClipBounds(&outBounds)) {
+                // current clip is empty
+                return false;
+            }
+        }
+    }
+
+    SkRect clip;
+
+    if (this->getClipBounds(&clip) && outBounds.intersect(clip)) {
+        this->getTotalMatrix().mapRect(&outBounds);
+        this->handleBBox(outBounds);
+        return true;
+    }
+
+    return false;
+}
+
diff --git a/src/core/SkBBoxRecord.h b/src/core/SkBBoxRecord.h
new file mode 100644
index 0000000..5a90727
--- /dev/null
+++ b/src/core/SkBBoxRecord.h
@@ -0,0 +1,76 @@
+
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkBBoxRecord_DEFINED
+#define SkBBoxRecord_DEFINED
+
+#include "SkPictureRecord.h"
+
+/**
+  * This is an abstract SkPictureRecord subclass that intercepts draw calls and computes an 
+  * axis-aligned bounding box for each draw that it sees, subclasses implement handleBBox()
+  * which will be called every time we get a new bounding box.
+  */
+class SkBBoxRecord : public SkPictureRecord {
+public:
+
+    SkBBoxRecord(uint32_t recordFlags) :INHERITED(recordFlags) { }
+    virtual ~SkBBoxRecord() { }
+
+    /**
+     * This is called each time we get a bounding box, it will be axis-aligned,
+     * in device coordinates, and expanded to include stroking, shadows, etc.
+     */
+    virtual void handleBBox(const SkRect& bbox) = 0;
+
+    virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
+                            const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
+    virtual void clear(SkColor) SK_OVERRIDE;
+    virtual void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, 
+                          const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
+                            const SkPaint* paint = NULL) SK_OVERRIDE;
+    virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
+                                const SkRect& dst, const SkPaint* paint) SK_OVERRIDE;
+    virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& mat,
+                                  const SkPaint* paint) SK_OVERRIDE;
+    virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+                                const SkRect& dst, const SkPaint* paint) SK_OVERRIDE;
+    virtual void drawPosText(const void* text, size_t byteLength,
+                             const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawPosTextH(const void* text, size_t byteLength,
+                              const SkScalar xpos[], SkScalar constY, 
+                              const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
+                            const SkPaint* paint) SK_OVERRIDE;
+    virtual void drawTextOnPath(const void* text, size_t byteLength,
+                                const SkPath& path, const SkMatrix* matrix,
+                                const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawVertices(VertexMode mode, int vertexCount,
+                              const SkPoint vertices[], const SkPoint texs[],
+                              const SkColor colors[], SkXfermode* xfer,
+                              const uint16_t indices[], int indexCount,
+                              const SkPaint& paint) SK_OVERRIDE;
+    virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
+
+private:
+    /** 
+     * Takes a bounding box in current canvas view space, accounts for stroking and effects, and
+     * computes an axis-aligned bounding box in device coordinates, then passes it to handleBBox()
+     * returns false if the draw is completely clipped out, and may safely be ignored.
+     **/
+    bool transformBounds(const SkRect& bounds, const SkPaint* paint);
+
+    typedef SkPictureRecord INHERITED;
+};
+
+#endif
+
