void BoardDrawer::drawEmpty(int row, int col, int number) { m_ctx->fillRect(col * 10, row * 10, 10, 10); m_ctx->clearRect(col * 10 + 1, row * 10 + 1, 8, 8); if (number > 0) { sprintf(buffer, "%u", number); m_ctx->fillText(std::string(buffer), col * 10 + 2, row * 10 + 8.5); } }
JSValue* jsCanvasRenderingContext2DPrototypeFunctionFillRect(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSCanvasRenderingContext2D::s_info)) return throwError(exec, TypeError); JSCanvasRenderingContext2D* castedThisObj = static_cast<JSCanvasRenderingContext2D*>(thisValue); CanvasRenderingContext2D* imp = static_cast<CanvasRenderingContext2D*>(castedThisObj->impl()); float x = args[0]->toFloat(exec); float y = args[1]->toFloat(exec); float width = args[2]->toFloat(exec); float height = args[3]->toFloat(exec); imp->fillRect(x, y, width, height); return jsUndefined(); }
void BoardDrawer::drawCovered(int row, int col) { m_ctx->fillRect(col * 10 + 1, row * 10 + 1, 8, 8); }