ResultType Clipboard::Set(LPCTSTR aBuf, UINT_PTR aLength) // Returns OK or FAIL. { // It was already open for writing from a prior call. Return failure because callers that do this // are probably handling things wrong: if (IsReadyForWrite()) return FAIL; if (!aBuf) { aBuf = _T(""); aLength = 0; } else if (aLength == UINT_MAX) // Caller wants us to determine the length. aLength = (UINT)_tcslen(aBuf); if (aLength) { if (!PrepareForWrite(aLength + 1)) return FAIL; // It already displayed the error. tcslcpy(mClipMemNewLocked, aBuf, aLength + 1); // Copy only a substring, if aLength specifies such. } // else just do the below to empty the clipboard, which is different than setting // the clipboard equal to the empty string: it's not truly empty then, as reported // by IsClipboardFormatAvailable(CF_TEXT) -- and we want to be able to make it truly // empty for use with functions such as ClipWait: return Commit(); // It will display any errors. }
void PathBuilderCairo::LineTo(const Point &aPoint) { PrepareForWrite(); CairoTempMatrix tempMatrix(*mPathContext, mTransform); cairo_line_to(*mPathContext, aPoint.x, aPoint.y); }
ResultType Clipboard::Set(LPCTSTR aBuf, UINT_PTR aLength) //, bool aTrimIt) // Returns OK or FAIL. { // It was already open for writing from a prior call. Return failure because callers that do this // are probably handling things wrong: if (IsReadyForWrite()) return FAIL; if (!aBuf) { aBuf = _T(""); aLength = 0; } else if (aLength == UINT_MAX) // Caller wants us to determine the length. aLength = (UINT)_tcslen(aBuf); if (aLength) { if (!PrepareForWrite(aLength + 1)) return FAIL; // It already displayed the error. tcslcpy(mClipMemNewLocked, aBuf, aLength + 1); // Copy only a substring, if aLength specifies such. // Only trim when the caller told us to, rather than always if g_script.mIsAutoIt2 // is true, since AutoIt2 doesn't always trim things (e.g. FileReadLine probably // does not trim the line that was read into its output var). UPDATE: This is // no longer needed because I think AutoIt2 only auto-trims when SetEnv is used: //if (aTrimIt) // trim(mClipMemNewLocked); } // else just do the below to empty the clipboard, which is different than setting // the clipboard equal to the empty string: it's not truly empty then, as reported // by IsClipboardFormatAvailable(CF_TEXT) -- and we want to be able to make it truly // empty for use with functions such as ClipWait: return Commit(); // It will display any errors. }
void PathBuilderCairo::BezierTo(const Point &aCP1, const Point &aCP2, const Point &aCP3) { PrepareForWrite(); CairoTempMatrix tempMatrix(*mPathContext, mTransform); cairo_curve_to(*mPathContext, aCP1.x, aCP1.y, aCP2.x, aCP2.y, aCP3.x, aCP3.y); }
//----------------------------------------------------------------------------------------------- void ResourceStream::WriteBytesDirectly( const void* source, int numBytesToWrite ) { // DEBUGGING - { int q = 5; } //ConsolePrintf( "WriteBytesDirectly: Writing %d bytes at offset %d\n", numBytesToWrite, m_dataBytesAvailable ); PrepareForWrite( numBytesToWrite ); unsigned char* writePosition = m_startOfData + m_dataBytesAvailable; memcpy( writePosition, source, numBytesToWrite ); m_dataBytesAvailable += numBytesToWrite; m_consecutiveNewLineCount = 0; m_justWroteBlockBegin = false; m_justWroteBlockEnd = false; }
void PathBuilderCairo::QuadraticBezierTo(const Point &aCP1, const Point &aCP2) { PrepareForWrite(); CairoTempMatrix tempMatrix(*mPathContext, mTransform); // We need to elevate the degree of this quadratic Bézier to cubic, so we're // going to add an intermediate control point, and recompute control point 1. // The first and last control points remain the same. // This formula can be found on http://fontforge.sourceforge.net/bezier.html Point CP0 = CurrentPoint(); Point CP1 = (CP0 + aCP1 * 2.0) / 3.0; Point CP2 = (aCP2 + aCP1 * 2.0) / 3.0; Point CP3 = aCP2; cairo_curve_to(*mPathContext, CP1.x, CP1.y, CP2.x, CP2.y, CP3.x, CP3.y); }
// ========================================================================== // METHOD: Destructor // // DESIGN: // ========================================================================== EXPORT_C RDebugLog::~RDebugLog() { if( iLogFileHandler ) { // Error! This means that Open was called, but not Close. if( PrepareForWrite() ) { _LIT8( KDummyFuncName, "***" ); _LIT8( KErrorText, "DEBUG LOG NOT CLOSED!" ); iLogFileHandler->Write( iClassName8, KDummyFuncName, KErrorText ); WriteComplete(); } // end if Close(); } } // END Destructor
void PathBuilderCairo::Close() { PrepareForWrite(); cairo_close_path(*mPathContext); }